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 Sheets query to get sum of two columns

I am trying to get sum of two columns using Query function and am getting perfect result when all the two columns have value, however, if any of the column is not having a value than the result will be blank. In such a case I want to reflect the value of the second column having data. Check the below image:

enter image description here

Formula used =QUERY(A2:C,"select A,B+C label B+C ”",0)

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

Sharing the link of the sheet too for reference.
https://docs.google.com/spreadsheets/d/1TID_7m6MTNviLkU0dlPoCDyA8Uv9Iann2WtCYL9CJQo/edit#gid=0

Any help on above will be appreciated.
I had also searched community for similar issue but not found the exact match.

>Solution :

Give a try on below formula-

=QUERY({A2:A,INDEX(IF(B2:C="",0,B2:C))},"select Col1,Col2+Col3 where Col1 is not null label Col2+Col3 ''")
  • Here IF(B2:C="",0,B2:C) will convert null cells to zero 0 values.

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