Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Google Sheet – QUERY SELECT does not handle apostrophe in WHERE CLAUSE

I have this Google Sheet report.

The problem is when my client name has an apostrophe, it breaks the formula.

=IFERROR(INDEX(QUERY(Projects!$1:$2018, "select sum(G) where A='"&A2&"'"),2), 0)

https://docs.google.com/spreadsheets/d/16UOU5iMwieHjVmV81TdK3_emxyj-wFqXa8u5Nia7Wkg/edit#gid=1016414243

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Do you know how I can change this ?

Thanks.

>Solution :

Try with triple double quotes to escape those single quotes you have:

=IFERROR(INDEX(QUERY(Projects!$1:$2018, "select sum(G) where A="""&A2&""""),2), 0)

enter image description here

You can also use SUMIF, and don’t worry about how the values are written:

=SUMIF(Projects!A:A,A2,Projects!G:G)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading