Google-sheets – Stacking IF Statements

google sheetsgoogle-sheets-arrayformula

I am trying to pull data from another sheet based on selections made from multiple dropdown boxes. For example… If column 1 text reads RAZA pull data, if column 1 reads Standard pull data. So on and so forth. What I have done so far is:

=ARRAYFORMULA(IF(Sheet1!C2="Raza",QUERY(IMPORTRANGE("1ZLFN3ix5FtRoOPIUfxFl1oPsobFFahKqod9tOLGDgcY","Playfield!$A$2:$f"),"SELECT Col2, Col3, Col4, Col5, Col6 WHERE Col1 = 'Raza'"),IF(Sheet1!C3="Standard",QUERY(IMPORTRANGE("1ZLFN3ix5FtRoOPIUfxFl1oPsobFFahKqod9tOLGDgcY","Playfield!$A$2:$f"),"SELECT Col2, Col3, Col4, Col5, Col6 WHERE Col1 = 'Standard'"))))

The first IF statement pulls data accordingly, the second one does not. What am I doing wrong?

Best Answer

Instead of the formula in the question use

=QUERY(IMPORTRANGE("1ZLFN3ix5FtRoOPIUfxFl1oPsobFFahKqod9tOLGDgcY","Playfield!$A$2:$f"),"SELECT Col2, Col3, Col4, Col5, Col6 WHERE Col1 = '"&Sheet1!C2&"'")

The above because the value on Sheet1!C2 is used as the value to be compared with the values on Col1, & is the concatenation operator.