Working with multiple If statements, data validation and multiple sheets in 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


Anyone care to help me out with this?