Forum Discussion
Please Help Excel Rank Dilemma
| Name | Score | back 6 | back 3 | back 1 | Rank | Rank should be | |
| John | 26 | 13 | 5 | 1 | 6 | 6 | |
| Howard | 26 | 11 | 6 | 0 | 5 | 7 | |
| Kevin | 26 | 14 | 5 | 3 | 2 | 5 | |
| Declan | 26 | 14 | 8 | 4 | 2 | 2 | |
| Darren | 27 | 12 | 5 | 2 | 1 | 1 | |
| Jim | 26 | 14 | 8 | 3 | 2 | 3 | |
| Fionn | 26 | 14 | 8 | 1 | 2 | 4 | |
| How do I rank the above table, firstly by Score, then if tied by back 6, then if tied by back 3 then if tied by back 1. I have used Rankeq and countifs but can only make it work on score then back 6. the ranking should be as in column G | |||||||
3 Replies
- mathetesGold Contributor
As I said, my approach was "one way." One of the delightful things about Excel is that there are always several different ways to get from point A (the problem) to B (the solution). Patrick2788 has given one that comes at the problem a different way, leaving the original array as it was in your introductory request, and producing the final column with the correct ranking.
I chose to rearrange the original array in sorted order.
Which result is "better" depends, as is often the case, on what you will be doing with that result, that output.
- Patrick2788Silver Contributor
I may need to see more sample data and outcomes but this matches your desired return:
=LET( rank, SORTBY(name, Score, -1, back_6, -1, back_3, -1, back_1, -1), desired, XMATCH(name, rank), desired ) - mathetesGold Contributor
Here's one way: The SORTBY function will sort the entire table, listing the names (and remaining columns) in the desired order. (By the way, you didn't specify that the rankings are by low score, not high; that's a key part of the definition of the problem; you perhaps took it for granted),
=SORTBY(A4:D10,B4:B10,-1,C4:C10,-1,D4:D10,-1)Here's what it looks like (absent headers)
See attached for the working example.