Statistics function
RANK.EQ function in Google Sheets and Excel
RANK.EQ returns a number's position in a list: 1 for the largest by default, or 1 for the smallest if you ask.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
RANK.EQ(number, ref, [order])Arguments in [brackets] are optional. Google Sheets writes it RANK.EQ(value, data, [is_ascending]).
Example
=RANK.EQ(C2,$C$2:$C$13) reads: Rank Noor's study hours in C2 within the whole locked list $C$2:$C$13, with 1 for the most hours; filled down, every student gets a rank.
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Student | Class | Hours | Score | Hours rank | From | Grade | |
| 2 | Noor | A | 2 | 48 | 11 | 0 | F | |
| 3 | Mateo | B | 5 | 66 | 8 | 50 | D | |
| 4 | Hana | A | 8 | 81 | 3 | 60 | C | |
| 5 | Ollie | B | 3 | 55 | 10 | 70 | B | |
| 6 | Zara | A | 10 | 93 | 1 | 85 | A | |
| 7 | Ivan | B | 6 | 72 | 6 | |||
| 8 | Lea | A | 1 | 39 | 12 | |||
| 9 | Omar | B | 7 | 77 | 5 | |||
| 10 | Sara | A | 9 | 88 | 2 | |||
| 11 | Theo | B | 4 | 61 | 9 | |||
| 12 | Yuki | A | 6 | 70 | 6 | |||
| 13 | Bea | B | 8 | 84 | 3 |
E2 shows 11: Noor's 2 hours is the second-lowest of twelve.
How the spreadsheet calculates it
Gives the rank of C2 within $C$2:$C$13 (1 = the largest). Ties share a rank.
- 1. RANK.EQ: Gives the rank of
C2within$C$2:$C$13(1 = the largest). Ties share a rank.value=`C2`: the number to rankrange=`$C$2:$C$13`: the whole list, locked
More RANK.EQ examples
=RANK.EQ(D2,$D$2:$D$13)Each student's exam rank, 1 for the highest score (fill down).=RANK.EQ(D2,$D$2:$D$13,1)The same ranks the other way round: 1 for the lowest score.=RANK.EQ(C2,$C$2:$C$9)On the sales sheet: each rep's July rank.=IF(RANK.EQ(D2,$D$2:$D$13)<=3,"Top 3","")A label on the three highest scores.
Paste any of these into the formula explainer to see it step by step.
Tips
- Lock the list with
$before filling down. - Use order 1 whenever smaller is better (times, costs, defects).
- Combine with SORTBY or a filter on the rank to show only the top few.
What RANK.EQ is used for
League tables for sales reps, ranking students or products by score, picking the top performers for a report, and ordering finishing times with ascending order.
Arguments
| Argument | Required | What it is |
|---|---|---|
| number | Yes | The value to rank, such as C2. |
| ref | Yes | The whole list to rank against, locked with $ so it stays put when you fill down.Watch out: Unlocked, the list shrinks row by row and the ranks go wrong. |
| order | No | 0 or left out ranks the largest as 1; any other number (usually 1) ranks the smallest as 1. |
Common mistakes
Forgetting the
$: the list shrinks as you fill down.Expecting ties to get different ranks: equal values share a rank, and the next rank is skipped (two 2nds, then 4th).
Forgetting order when lower is better, such as finishing times: add 1 as the third argument so the fastest is 1.
Ranking text: non-numeric values in the list are ignored, so a number stored as text gets no rank.
In Google Sheets
Google Sheets has RANK.EQ with the same three arguments; Google calls the third one is_ascending (RANK.EQ(value, data, [is_ascending])).
Errors you may see with RANK.EQ
Questions
What's the difference between RANK, RANK.EQ and RANK.AVG?
RANK.EQ gives tied values the top rank of the group (two values in 2nd place both get 2). RANK.AVG gives them the average (2.5). RANK is the older name for RANK.EQ, kept for compatibility.
How do I rank from smallest to largest?
Add 1 as the third argument: RANK.EQ(C2, $C$2:$C$13, 1). The smallest value then gets rank 1.
How do I rank without gaps after ties?
RANK.EQ always skips after ties. For a dense rank (1, 2, 2, 3) see the rank without skipping recipe.
How do I rank within a group?
Count how many in the same group beat the value: COUNTIFS($B$2:$B$13, B2, $C$2:$C$13, ">"&C2)+1 ranks each student within their class.
Sources
Official documentation the facts on this page were checked against.