Spreadsheet function to sum all values in one column based on criteria from another column
Something like this
X 10
Y 3
X 7
X 22
Y 4
Y 9
X "=SUMIF(A1:A6;A8;B1:B6)"
Y "=SUMIF(A1:A6;A9;B1:B6)"
use SUMIF(range, criteria, sum_range)
: (sum values between B2-B8, using value in A2-A8 as criterea, using the specified condition)
=SUMIF(A2:A8,"=X",B2:B8)
=SUMIF(A2:A8,"=Y",B2:B8)
You can use SUMPRODUCT
to calculate the totals. For the "X" values:
=SUMPRODUCT((A1:A6="X")*(B1:B6))
for the "Y" values:
=SUMPRODUCT((A1:A6="Y")*(B1:B6))
Hope that helps,
Eric Melski
EDIT: Apparently you must use ARRAYFORMULA to use SUMPRODUCT in Google's spreadsheet. See for example http://www.google.com/support/forum/p/Google+Docs/thread?tid=13a3eb824446e891&hl=en