Google Sheet Query Function Issues

Viewed 34

I have a good working Query function except for a few cases where its calling from and searching from variables on my data sheet.

=QUERY(detailedManifest,"SELECT K, J, SUM(H) WHERE C = '"&A3&"' AND K <> 'SAMPLES' GROUP BY J, K  ORDER BY K LABEL SUM(H) ''", 0)

It works on everything except when A3 = Bacon's Buds or Bella Jane's I believe it's because there is ' in the name. Is there a work around that would allow the name to be as is and still work within the Query function?

1 Answers
=QUERY(detailedManifest,"SELECT K, J, SUM(H) WHERE C = """&A3&""" AND K <> 'SAMPLES' GROUP BY J, K  ORDER BY K LABEL SUM(H) ''", 0)

Just had to change my '"&A3&"' to be """&A3&""" and this allowed the names Bacon's Buds and Bella Jane's to work correctly within the query! YAY

Related