Google-sheets – Sum values with same name

google sheets

I have a Google Sheets with a long list of names and amounts. Many of the names are duplicates. For example:

John  | 10
Bill  | 2
Susan | 3
Frank | 4
Sally | 10
John  | 2
Susan | 2
John  | 3

Is there any automated way to combine all of the values so I get a list without any duplicate names and a single sum of all of each person's entry?

For example:

John  | 15
Bill  | 2
Susan | 5
Sally | 10

Best Answer

Assuming names are in A1:A8, amounts in B1:B8, first we need unique name list in D1:

=UNIQUE(A1:A8)

Then use conditional sum in E1:

=SUMIF(A$1:A$8,D1,B$1:B$8)

Please note $ prefix before cell number. This will keep the same ranges when we copy cell contents down (select cells E1:E8 and press Ctrl+D).