1

Can you tell me what's wrong with my formula?


= QUERY (IMPORTRANGE ("url googlesheets database"; "Data range"); "SELECT Col1 
WHERE Col1 =" A3 "AND Col2 =" B3 "")

The "A3" and "B3" are cells in the active google sheets.

0
0

The second parameter of the QUERY functions is not using the correct syntax to concatenate values.

Instead of

"SELECT Col1 WHERE Col1 =" A3 "AND Col2 =" B3 ""

if Col1 and Col2 holds only number values use

"SELECT Col1 WHERE Col1 ="& A3 &" AND Col2 ="& B3 

if Col1 and Col2 holds only text values use

"SELECT Col1 WHERE Col1 ='"& A3 &"' AND Col2 = '"& B3 &"'"

NOTES:

  • & is the concatenate operator.
  • QUERY requires that text values be enclosed using '.
2
  • Thanks for the help and the explanations, I managed to use the first formula only for the values. On the other hand, I did not succeed in using the second formula only for text. Do you think there is something missing in the second proposed formula? Thank you again for your help Philippe – Philippe Dubrulle May 6 at 16:49
  • I suggest you to post a new question including a link to a demo spreadsheet shared with anyone with the link to view only. – Rubén May 6 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.