Google-sheets – Sum value with same name

google sheets

I have a Google Spreadsheet with a long list of names and numbers. Many of the names are duplicates but with different numbers in front of them. For example:

sample data

What will be the formula which will sum numbers of A, B, C, D and E? For example: the result of A will be 12. B will be 4 and so on.

Best Answer

You can do that by using the following formula:

=QUERY({B1:C5;D1:E5;F1:G5}, "SELECT Col1, SUM(Col2) GROUP BY Col1 LABEL SUM(Col2) ''")

or

=QUERY({B:C;D:E;F:G}, "SELECT Col1, SUM(Col2) WHERE Col1 <> '' GROUP BY Col1 LABEL SUM(Col2) ''")

See screenshot: enter image description here

I've created an example file for you: sum value with same name