views:

59

answers:

3

Hi

I have a bunch of columns and some columns which are values I need to add. Lets say I want to sum columnB (which could be $) where column A is banana, how do I do that?

Thing is I have a huge dataset and it is something that is going to keep changing. And besides banana, i might have apples, oranges, etc. And I want to sum the $ value to the respective column param.

And I wonder if I can do this in Excel.

PLease let me know if possible. Much appreciated.

sriram

+2  A: 

Look up the SUMIF function

http://office.microsoft.com/en-us/excel/HP052092921033.aspx

You can do somethig like this

=SUMIF(A1:A10, "banana", B1:B10)

To make it dynamic, lets say A11 has "apple", B11 has "banana" and C11 has "orange" and you want the sums in the row below

in A12, put =SUMIF ($A$1:$A$10, A11, $B$1:$B$10)

in B12, put =SUMIF ($A$1:$A$10, B11, $B$1:$B$10)

in C12, put =SUMIF ($A$1:$A$10, C11, $B$1:$B$10)

Raj More
Thank you so much Raj.
Sriram
+1  A: 

Check out the SUMIF formula.

For example:

=SUMIF(A1:A5, "banana", B1:B5)

In this example, A1:A5 is your value range. "banana" is the value you can evaluate against (this can be a cell reference). And B1:B5 are your values to be summed.

Stuart
Yes! This works. I read it off someone else's question here. Feel guilty for asking and taking up your times. Thanks so much Stuart.
Sriram
+1  A: 

you're looking for the sumif function: http://www.techonthenet.com/excel/formulas/sumif.php

in your case you would use it like this: sumif(A1:A1000, "banana", B1:B1000)