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

1 Answer 1

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 Commented May 6, 2021 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. Commented May 6, 2021 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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