Google Sheets – Dynamic Query Using TRUE or FALSE

google sheetsgoogle-sheets-query

I have a checkbox in Column R. (values are TRUE OR FASLE).

I want a dynamic query. I will ask the user to select a value in B2 where "true" or "false" is selected.

The below query is working (no error) , but not fetching any records.

=query(Plan!C:AU,"select C,D,E,I, L,M,N,F,G where I>0 and G= '" & $A$2 & "' and R ='" & $B$2 & "' order by L label L 'QC Dt' ",1)

The Query is working well for Column G from what is selected in A2. It is normal text value.

But, how to use it for a logical variable?

Best Answer

Please try changing your formula to:

=query(Plan!C:AU,"select C,D,E,I,L,M,N,F,G where I>0 and G= '" & $A$2 & "' and R=TRUE order by L label L 'QC Dt' ",1)

Bassically change R ='" & $B$2 & "' to R=TRUE