Google-sheets – Suming cell values according to another cell

google sheets

Consider the following spreadsheet:

enter image description here

I want to sum every cell on column A that shares the same value on the same row on column B.

For instance, I want to sum all A cells whose respective B cells have "Conta – Casa" in them.

I have almost 0 knowledge on spreadsheets, I'm not even sure I'm making myself clear explaining my problem.

EDIT: Thank you very much WELZ!, that just did the trick!

One note, though: both your example and the example given by Google Sheets documentation did not work for me and I lost a good 10 minutes figuring out why.

For pt-br locale reasons, arguments in the formula must be separated by semicolons, not commas. I found that out by looking at the pt-br version of the same documentation here: here. Weirdly enough, when I try typing "SOMASE", the pt-br translation of "SUMIF", on a cell, sheets translates it back to it's english counterpart.

Thank you very much!

Best Answer

You can use a SUMIF statement.

The syntax is as follows

SUMIF(range, criterion, [sum_range])

In your case, you want to sum the A column, but only where the corresponding row in the B column contains "Conta - Casa"


The formula you would use is:

=SUMIF(B:B, "Conta - Casa", A:A)

You can read more about SUMIF here.


Here's an example I did with the following formula

=SUMIF(B:B, "bar", A:A)

sample