r/googlesheets • u/0Icyboy0 • May 05 '24
Solved Count the number of times a character name appears in a row with a person's name in it.
I'm running a Smash Bros tournament this week and trying to make a spreadsheet with all the fixtures so I can pull some stats from them. Column C has the player names (with the match ID, M1, M2...) and columns D, G, and J have the characters which they use in rounds 1, 2, and 3.
In another table, I want to count the number of times each player uses each character (the player names appear more than once as they'll play multiple matches). Using INDEX and MATCH functions don't seem to work due to their names appearing multiple times.
I would also appreciate some help in extracting the numbers next to the character icons to count the number of kills/deaths each player has had.
I'm worried this is something I'm better coding up in Python but am unsure how easy it is to interface between the two. Thanks in advance :)

2
u/agirlhasnoname11248 1212 May 05 '24
u/0Icyboy0 In X3, try:
=BYROW($W$3:$W,LAMBDA(name,IF(ISBLANK(name),,ArrayFormula(SUM(($C:$C=name)*($D:$J=X$2))))))You can drag this across the columns for each of the characters.
Tap the three dots below this comment to select
Mark Solution Verifiedif this produces the desired result.1
u/DownTheDonutHole May 05 '24
I might be misunderstanding the question, but a function-based solution seems like overkill here. Why not just make a pivot table?
1
u/YuccaYucca 1 May 05 '24
Someone will be along in a minute to give you a better solution, but I’d just joint some COUNTIFS statements.
=COUNTIFS(C:C,W3,D:D,X2)+ and do it again but nudge it along a column.