1

I have a query which works on certain condition

query1 =query('KEY WORK'!A1:I200,"select A,B,C,D where E = '"&B8&"' and A = '"&B4&"' and I = FALSE",)

query2 =query('KEY WORK'!A1:I200,"select A,B,C,D where E = '"&B8&"' and A = '"&B4&"' and I = TRUE",)

Now My problem is that I want to use if function and it should be like this:

=if(B4="ALL" then run Query1 else Query2)
0

Use the IF command when forming the query string.

query1 =query('KEY WORK'!A1:I200, "select A,B,C,D where E = '"&B8&"' and A = '"&B4&"' and I = "&if(B4="ALL", "FALSE", "TRUE"))

The second parameter of query is just a string that you can form using whatever spreadsheet logic is available for string formation.

0

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .