Tuesday, January 31, 2012

yogi_Sum Up Values by Key That Match The Items In A List

Yogi Anand, D.Eng, P.E.                                         Google Spreadsheet                            www.energyefficientbuild.com
user bvboe said:
I have three columns, a key and value pair, and a list of keys. I want sum the values for all keys that appear in my list of keys. Eg:
KEY VALUE LIST
A     1    A
A     2    B
B     3    B
B     4    B
C     5    A
C     6    Z
D     7
D     8
What I am trying to get is
RESULT
3
7
I have searched and tested for months with no success. Any help would be enormously appreciated.
2011-12-29
Sorry, I just realized I wrote the subject wrong, it should b:
select sum(b) where a IS IN ARRAY(c2:c)
--------------------------------
following is a solution to the problem