QUERY syntax using cell reference

Mr. B picture Mr. B · May 2, 2014 · Viewed 136.5k times · Source

I'm having trouble figuring out a fairly simple QUERY statement in Google Spreadsheets. I'm trying to use a cell reference instead of static values and I'm running into trouble. Below it the code I'm using, but I keep getting a "Error: Formula parse error."

=QUERY(Responses!B1:I, "Select B where G contains"& $B1 &)

I'm sure it is a simple error, but can someone please show me how to write the above so the QUERY is pulling data from B where G contains the value in cell B1 (cell reference)?

Answer

pnuts picture pnuts · May 22, 2014

Copied from Web Applications:

=QUERY(Responses!B1:I, "Select B where G contains '"&$B1&"'")