Failed query for the Google spreadsheet

2

I'm making a query for the google spreadsheet and it's giving me a bug in the last part of it. The query works with 3 data that are inserted by validation in boxes B1, D1 and B2.

This is what I have:

=if(AND(B1=0;B2=0;D1=0);IMPORTRANGE("LINK"; "Llista!A6:S1000");if(AND(B1>1;B2>1;D1=0);query(IMPORTRANGE("LINK"; "Llista!A6:S1000");"select * where Col6='"&B1&"' and Col8='"&B2&"'");query(IMPORTRANGE("LINK"; "Llista!A6:S1000");"select * where Col6 IN('"&B1&"','"&D1&"') and Col8='"&B2&"'")))

This is the part that fails me:

query(IMPORTRANGE("LINK"; "Llista!A6:S1000");"select * where Col6 IN('"&B1&"','"&D1&"') and Col8='"&B2&"'")))

The error he gives me is:

Unable to parse the query string for In the QUERY function, parameter 2: PARSE_ERROR: Encountered "" Col6 "" at line 1, column 16. Was expecting one of: "(" ... "( "...

I modify the line to solve the previous error "I believe"

query(IMPORTRANGE("LINK"; "Llista!A6:S1000");"select * where Col6 IN"("'"&B1&"','"&D1&"'")" and Col8='"&B2&"'")))

And I get the error:

Formula analysis error.

This last part, should select the data that have the category B1 and D1 and filter them through the B2 zone.

For example B1 and D1 are police ranks and B2 where they are destined.

    
asked by Iván Montero 20.12.2018 в 08:11
source

1 answer

1

Fixed, simply google does not support the use of IN so it fits like this:

=query(IMPORTRANGE("LINK";"Llista!A6:S1000"); "select * where (Col6 ='"&B1&"' or Col6 = '"&D1&"') and Col8 ='"&B2&"'")

    
answered by 20.12.2018 в 13:21