Google-sheets – Working with multiple If statements, data validation and multiple sheets in Google Sheets

google sheets

I'm working on a spreadsheet and could really use some help. I'm trying to populate cells in a main worksheet with cells from another worksheet within the spreadsheet.

Currently I'm planning on having a dropdown using data validation in A1 to select which sheet to view, and populate it based on what is selected.

In the populated sheets the code in A2 looks somewhat like this

=IF(REGEXMATCH(A1,"SheetA), SheetA!A2, IF(REGEXMATCH(A1,"SheetB"), SheetB!A2))

Currently this works flawlessly for the first if statement, but not for the second. My understanding was that the if function in google sheet was formated like this

=IF(WHAT_TO_CHECK, DO IF TRUE, DO IF FALSE)

Anyone care to help me out with this?

Best Answer

I got this to work, the above is correct - I simply fudged it with other old code etc. Will leave this here for future googlers.