Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I want to return the sum of all cells in ColumnA only if the value of a cell on the same row is equal to a specific value.

For example, sum C4 if D4 = "Bob". Assuming there are six rows whereby "Bob" appears in ColumnD, I would expect that the sum of six values from ColumnC would be added together.

My suspicion is the above requires use of a loop, which Google Spreadsheets does not provide.

share|improve this question

2 Answers 2

=SUMIF(D:D,"bob",C:C)

in C column are numbers, in D column are ("bob" or others)

if you wish do not sum all column you can use for example

=SUMIF(D2:D6,"bob",C2:C6)  

Note: Text is case sensitive (Bob is not equal bob)

share|improve this answer
1  
It seems to me that sumif is case insensitive, –  WAF Nov 6 '11 at 5:24

You can use this formula:

=if( D4="Bob",sum(A0:A0),"null")

This will sum all the values in the A column if D4 is equal to Bob, otherwise it will put a null as the answer.

share|improve this answer
    
I agree Q is unclear as to which column is to be summed, but there is no row 0 and the requirement is to include in the total only values from rows where the D value is "Bob" (rather than sum all rows if a specific cell contains "Bob"). –  pnuts Jun 17 at 20:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.