Thursday, August 8, 2013

Google Spreadsheet Sum Column 1 if criteria matches in Column 2

Question:

( by Absolute Zero )


Google Chrome / Windows 7

I am trying to find a formula that will add numbers in Column B ONLY if they match criteria in Column A.

A sample would be:

Column A    Column B

AVAT           1
ML               1
ML               1
AVAT           1
AVAT           1
AVAT           1


ML =           2
AVAT =       4


Please let me know how I can achieve this, I have been struggling with it for awhile.. thank you!

Solution:


Have a look at the following screenshot of my Spreadsheet:


I have the data in Column A and B.

I have the value "ML" in Cell D1 and I have the following formula in Cell E1:
=sumif(A:A;D1;B:B)


I have the value "AVAT" in Cell D2 and I have the following formula in Cell E2:
=sumif(A:A;"AVAT";B:B)

And if you want to total for all the values in Column A, then you can also get the summing of Column B using group by query. I have the following formula in Cell H1:
=query(A:B;"select A,sum(B) where A<>'' group by A label sum(B) '' ")


I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.


I also take up private and confidential projects:
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html 

Thanks,

No comments:

Post a Comment