Forum Discussion
espensun
Oct 17, 2024Copper Contributor
Sorting a two column table using SORTBY and if values are identical, use a table to rank them
Hi, I have a two-column table with "Name" and "Points". To sort this table, I use the SORTBY function and that works as I would like it to do. However, if two or more persons have the same number of...
Lorenzo
Oct 17, 2024Silver Contributor
Hi espensun
Seems to do it... (used Tables - not mandatory):
=LET(
ranks, XLOOKUP( Points[Name], Ranks[Name], Ranks[Rank] ),
stacked, HSTACK( Points, ranks ),
sorted, SORTBY( stacked, Points[Points], -1, ranks, -1 ),
DROP( sorted,, -1)
)Lorenzo
Nov 06, 2024Silver Contributor
A more direct option (not mine):
=SORTBY( Points, Points[Score], -1,
XLOOKUP(Points[Name], Ranks[Name], Ranks[Rank] ), 1
)