RANK function
Returns the rank of a number in a list: 1 for the largest (or smallest, if you ask). Ties share the same rank. Replaced by RANK.EQ.
Available in All versions of Excel, including Microsoft 365 and Excel for the web (kept for compatibility)
In every Excel versionWorks in Google Sheets
Syntax
RANK(number, ref, [order])| Argument | What it means | |
|---|---|---|
number | Required | The value whose rank you want. |
ref | Required | The range of numbers to rank against. Non-numbers are ignored. |
order | Optional | 0 or omitted: largest value gets rank 1 (descending). Any non-zero value: smallest gets rank 1 (ascending). |
Returns: A whole number: the position of number in the list.
How RANK works
RANK tells you where a value stands in a list: the top salesperson, the fastest lap, the third-highest score. By default the largest value is ranked 1; set order to 1 for lists where smaller is better, such as race times or costs.
Equal values get the same rank and the next rank is skipped: if two people tie for 1st, the next person is 3rd. Make sure ref uses absolute references ($B$2:$B$6) before you fill the formula down, or the range will slide and the ranks will be wrong. number should be one of the values in ref; otherwise RANK returns #N/A.
Compatibility note: since Excel 2010 RANK is a compatibility function. RANK.EQ gives exactly the same results, and RANK.AVG gives tied values the average of their positions (two tied for 1st both get 1.5), which is what some statistical tests require.
Examples
1Rank salespeople by revenue
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Revenue | |
| 2 | Ana | 48200 | 3 |
| 3 | Ben | 51900 | |
| 4 | Cara | 39750 | |
| 5 | Dev | 51900 | |
| 6 | Eli | 45300 |
Result: 3
Two reps (Ben and Dev) have more than Ana's 48,200, so Ana is ranked 3. Fill the formula down to rank everyone.
2Ties share a rank
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Revenue | |
| 2 | Ana | 48200 | |
| 3 | Ben | 51900 | 1 |
| 4 | Cara | 39750 | |
| 5 | Dev | 51900 | |
| 6 | Eli | 45300 |
Result: 1
Ben and Dev tie on 51,900 and both get rank 1. Nobody is ranked 2; Ana is 3. RANK.AVG would give both 1.5.
3Fastest time ranked first
| A | B | C | |
|---|---|---|---|
| 1 | Runner | Time (s) | |
| 2 | Kim | 12.4 | |
| 3 | Lou | 11.9 | 2 |
| 4 | Max | 12.8 | |
| 5 | Ned | 11.7 |
Result: 2
With order = 1 the smallest value ranks first. Ned (11.7) is 1st and Lou (11.9) is 2nd.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#N/A | number is not found in ref (often because of rounding, or because ref slid when filled down). | Lock the range with $ signs and make sure the value really appears in the list. |
#VALUE! | number is text. | Convert text numbers with VALUE. |
Tips
- Always lock the range:
=RANK(B2, $B$2:$B$20). - To break ties by a second column, add a tiny tiebreaker:
=RANK(B2,$B$2:$B$6)+COUNTIFS($B$2:$B$6,B2,$C$2:$C$6,">"&C2). - In Microsoft 365 you can produce a sorted leaderboard without ranks at all using SORT or SORTBY.
Questions
What is the difference between RANK, RANK.EQ and RANK.AVG?
RANK and RANK.EQ are identical: ties share the best rank. RANK.AVG gives tied values the average of the ranks they occupy.
Why do my ranks show duplicates and gaps?
That is how ties work: two values tied for 2nd both get 2, and the next value is 4th.
How do I rank in ascending order?
Set the third argument to 1: =RANK(B2,$B$2:$B$10,1) ranks the smallest value first.
Google Sheets
RANK also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
RANK in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | PLADS |
| Dutch | RANG |
| Finnish | ARVON.MUKAAN |
| French | RANG |
| German | RANG |
| Hungarian | SORSZÁM |
| Italian | RANGO |
| Norwegian (Bokmål) | RANG |
| Polish | POZYCJA |
| Portuguese (Brazil) | ORDEM |
| Portuguese (Portugal) | ORDEM |
| Russian | РАНГ |
| Spanish | JERARQUIA |
| Swedish | RANG |