Sum Matches to a Google Sheets Query across an Arrayformula

Viewed 18

I have a table with two rows - a person's name and points. I'm looking to create a third column that uses an Arrayformula to match the name in column A and sum up the points for that person across all of column B.
A and B are static (with new entries added to the bottom) so I'm looking for the formula to use in column C.

Name Points Person's Total Points
John Smith 1. 1.25
Ellen Dee 0.5 0.5
Jerry Lewis 2 3
John Smith 0.25 1.25
Jerry Lewis 1 3

Here is a sample spreadsheet: https://docs.google.com/spreadsheets/d/1a1aQf4h4Qf1P_5YDldCxpHkaYtIQrFQjLQ3LR2LiJaE/edit?usp=sharing

I have tried this formula in C2 but it isn't working properly:
=ARRAYFORMULA(IF($A$2:$A="",,QUERY($A$2:$B,"SELECT SUM(B) WHERE A = '"&$A$2:$A&"'")))
Thank you

1 Answers

try:

=INDEX(IFNA(VLOOKUP(A2:A, QUERY(A2:B, "select A,sum(B) group by A"), 2, 0)))

enter image description here

Related