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. I keep getting Error: Formula parse error. with:

=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)?

2 Answers 2


Please try syntax of this kind:

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

For dates you need to use something like this

=query(Responses!B1:I,"select B where G = date '"& text(B1, "yyyy-mm-dd") &"' ")

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.