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&"'")
  • 1
    Thank you @pnuts! Your answer is exactly what I'm looking for! I used =QUERY(Responses!$B1:$I, "Select B where G contains '"&B1&"'") to get the job I needed DONE!
    – Mr. B
    May 3, 2014 at 13:26
  • This doesn't seem to be working for Date values Aug 21, 2015 at 23:22

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, privacy policy and cookie policy

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