How to QUERY (ImportRange) if the "where" clause also uses imported values?

753 views Asked by At

I am trying to query ImportRange data by the condition that a column matches a value from the imported spreadsheet, but it does not work:

=Query(importRange("KEY1","namesheet1!A2:R1600"), "select Col4 where Col7 = (importRange("KEY1","namesheet2!F108:F108"))  ",0)
1

There are 1 answers

0
Wicket On

Replace

"select Col4 where Col7 = (importRange("KEY1","namesheet2!F108:F108"))  "

by

"select Col4 where Col7 = " & importRange("KEY1","namesheet2!F108")