Home > Software design >  Find the winner, player with max points
Find the winner, player with max points

Time:10-05

please give me a hint on how to make this table.

Turn Player Points
1 Player1 10
2 Player3 15
3 Player1 22
4 Player6 10

...and so on. Basically, each turn some player earns some points. We don't know the number of players until the end, so I can't just make a list of players aside and SUMIF their points. I only need to find the WINNER, a player with the maximum amount of points, i.e. in this table it would be Player1 with 10 22=32 points. I only need one cell with WINNER: Player7

Is there a nice solution for this?

I'm using Excel 365, but vba is not allowed.

CodePudding user response:

With Office 365:

=LET(
    ply,B2:B5,
    pts,C2:C5,
    unq,UNIQUE(ply),
    INDEX(SORTBY(unq,SUMIFS(pts,ply,unq),-1),1,1))

enter image description here

CodePudding user response:

I would start by limiting the size of the table, e.g. to 500 rows.
You could make it a million rows, but it will slow the calculation

  1. Title Column D "Cumulative Points".
  2. In cell D2 enter "=SUMIF(B$2:B2,B2,C$2:C2)" and copy it down the column to 500 rows
    In cell D3, this will become "=SUMIF(B$2:B3,B3,C$2:C3)" etc.
  3. Title Column E "Player"
  4. In cell E2 write "= B2" and copy it down 500 rows
  5. Title Column G "Winner"
  6. In cell G2 write "=VLOOKUP(MAX(D$2:D$500),$D$2:$E$500,2,FALSE)"
  7. Hide columns D and E

Picture of spreadsheet before hiding cells

  • Related