简体   繁体   中英

Sum Matches to a Google Sheets Query across an Arrayformula

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

try:

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

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM