Google-sheets – Sum of all cells in Google Spreadsheet where matching row fits a value

google sheetsworksheet-function

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.

Best Answer

=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)