Mr. B
Mr. B

Reputation: 2787

QUERY syntax for using a 'cell reference' after the 'where'

I'm trying to use submitted Google Form data in one spreadsheet to locate and retrieve data from another spreadsheet (tab in same document). The Google Spreadsheet file is here.

The =QUERY statement I'm trying to use is below

=QUERY(sheet2!A1:K; "Select B, C where A =" & B1  ; 0)

It works if I remove the 'cell reference' from where A =" & B1 ; 0) and I replace it with a 'static value' like where A contains '123456' ")

Any suggestions on 'how' to get the =QUERY to work using a 'cell referenced' value. The heading for the column being referenced is TEXT but the value of all rows below the heading is a NUMBER

Thank you in advance,

Todd

Upvotes: 1

Views: 10124

Answers (1)

StueyKent
StueyKent

Reputation: 347

I know this is old but I had the same issue and thought my solution might help others. Adding single brackets round the cell reference worked for me.

=Query(sheet2!A1:K, "select B, C where A ='"&B1&"'")

Upvotes: 7

Related Questions