Skip to content

RANK.EQ

Returns the rank of a number within a list: 1 for the largest by default, or 1 for the smallest. Tied values share the top rank.

Syntax

=RANK.EQ(, , )

Statistical

Excel 2010 and later, including Excel for Microsoft 365 and Excel for the web. The older RANK function works in every version.

Try it

Edit the formula in C2 or change the inputs. The sheet recalculates as you type.

C2
A
B
C
1
Rep
Sales
Rank
2
Ines
48,200
3
3
Tom
31,750
4
Priya
62,000
5
Marco
42,900
6
Lena
37,400
7
Sam
22,650
8
Ana
56,300
9

C2 =RANK.EQ(B2,$B$2:$B$8) returns 3

How RANK.EQ works

RANK.EQ tells you where a value stands in a list. Use it for league tables, "top 10" lists, sales rankings, and flagging which rows are in the bottom quartile.

How it works

RANK.EQ compares the value in number with every number in ref and returns its position.

  • Descending (the default). The largest value is rank 1. Leave out order, or use 0.
  • Ascending. Set order to 1 and the smallest value is rank 1. Use this when low is good, such as defects, lap times or costs.

You do not need to sort the list. RANK.EQ gives the same answers whatever order the rows are in, so you can rank a table without rearranging it.

Ties

If two values are equal, RANK.EQ gives both the same rank, the higher of the positions they share. The next value then skips a number. For scores of 90, 85, 85 and 70, the ranks are 1, 2, 2 and 4: there is no rank 3. If you need ties to share an average rank such as 2.5, use RANK.AVG. If you need to break ties so every row has a unique rank, add a tie-breaker: =RANK.EQ(B2,$B$2:$B$8)+COUNTIF($B$2:B2,B2)-1 ranks equal values in the order they appear.

Lock the reference

The most common mistake is forgetting the dollar signs. Written =RANK.EQ(B2,B2:B8) and filled down, the range slides to B3:B9, B4:B10, and the ranks become wrong from the second row on. Write the reference as $B$2:$B$8 so every row ranks against the whole list.

RANK.EQ and RANK

RANK.EQ was added in Excel 2010. It behaves exactly like the older RANK function, which still works and is kept for compatibility. The newer name makes it clear that tied values get an equal rank, and sits alongside RANK.AVG. Use RANK.EQ in new workbooks. If a file has to open in Excel 2007 or earlier, use RANK.

What it can't do

RANK.EQ has no condition, so it ranks everything in the list together. To rank within a group, such as per region, use COUNTIFS: =COUNTIFS($A$2:$A$8,A2,$B$2:$B$8,">"&B2)+1. RANK.EQ cannot rank text, and returns #N/A if the value is not in the list.

The reverse question, "which value has rank 3?", is answered by LARGE and SMALL.

Arguments

number
The value to rank, usually a cell such as B2. It must appear in ref, or the result is #N/A.
ref
The list of numbers to rank against, such as $B$2:$B$8. Lock it with dollar signs when you fill the formula down. Text and blanks are ignored.
orderoptional
0 or omitted ranks from the largest down, so the biggest value is 1. Any other number, such as 1, ranks from the smallest up, so the smallest value is 1.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Rank a sales figure, highest first

C2 =RANK.EQ(B2,$B$2:$B$8)

Result: 3

Only Priya (62,000) and Ana (56,300) sold more than Ines, so Ines is third. Fill the formula down to rank everyone.

C2
A
B
C
1
Rep
Sales
Rank
2
Ines
48,200
3
3
Tom
31,750
4
Priya
62,000
5
Marco
42,900
6
Lena
37,400
7
Sam
22,650
8
Ana
56,300
9

C2 =RANK.EQ(B2,$B$2:$B$8) returns 3

Example 2

Rank lowest first (order = 1)

C2 =RANK.EQ(B2,$B$2:$B$6,1)

Result: 4

With order 1, the fastest time ranks first. R1's 12.4 seconds is the fourth fastest.

C2
A
B
C
1
Runner
Lap time (s)
Rank
2
R1
12.4
4
3
R2
11.9
4
R3
12.8
5
R4
11.5
6
R5
12.1
7

C2 =RANK.EQ(B2,$B$2:$B$6,1) returns 4

Example 3

Ties share a rank and leave a gap

C5 =RANK.EQ(B5,$B$2:$B$5)

Result: 4

S2 and S3 both rank 2, so there is no rank 3. The next score, 70, ranks fourth.

C5
A
B
C
1
Student
Score
Rank
2
S1
90
3
S2
85
4
S3
85
5
S4
70
4
6
7

C5 =RANK.EQ(B5,$B$2:$B$5) returns 4

Example 4

A value that is not in the list

B7 =RANK.EQ(75,B2:B5)

Result: #N/A

RANK.EQ only ranks values that appear in the list. 75 is not there, so the result is #N/A.

B7
A
B
C
1
Student
Score
2
S1
90
3
S2
85
4
S3
85
5
S4
70
6
7
Rank of 75
#N/A
8

B7 =RANK.EQ(75,B2:B5) returns #N/A

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In C2, rank Ines's sales against all the reps, with the highest sales ranked 1. Fill the formula down to C8.

Answer in C2, then it fills down to C8.

C2
A
B
C
D
E
1
Rep
Sales
Sales rank
Defects
Quality rank
2
Ines
48,200
4
3
Tom
31,750
9
4
Priya
62,000
2
5
Marco
42,900
7
6
Lena
37,400
5
7
Sam
22,650
12
8
Ana
56,300
3

Common mistakes

  • Forgetting $ on the list. RANK.EQ(B2,B2:B8) filled down becomes B3:B9, B4:B10 and the ranks drift. Write $B$2:$B$8.
  • Tied values share a rank and the next rank is skipped, so you can have 1, 2, 2, 4. If every row needs a unique rank, add a tie-breaker with COUNTIF.
  • #N/A means the number is not in the list. This happens when a value is rounded differently or stored as text. Use cell references rather than typed numbers.
  • The order argument is easy to flip. Omitted or 0 puts the largest first; any other number puts the smallest first.
  • RANK.EQ ranks the whole list together. For a rank within each group, use COUNTIFS.

Questions people ask

What is the difference between RANK and RANK.EQ?

They give the same results. RANK.EQ is the current name, introduced in Excel 2010, and RANK is kept for compatibility with older files. Use RANK.EQ in new work.

What is the difference between RANK.EQ and RANK.AVG?

With ties, RANK.EQ gives every tied value the top rank (1, 2, 2, 4). RANK.AVG gives them the average of the ranks they share (1, 2.5, 2.5, 4).

How do I rank without ties?

Add a tie-breaker: `=RANK.EQ(B2,$B$2:$B$8)+COUNTIF($B$2:B2,B2)-1`. Equal values are then ranked in the order they appear.

How do I rank from smallest to largest?

Set the third argument to 1: `=RANK.EQ(B2,$B$2:$B$8,1)`.

How do I rank within a group, such as each region?

Count the values in the same group that are bigger, and add 1: `=COUNTIFS($A$2:$A$8,A2,$B$2:$B$8,">"&B2)+1`.

Learn RANK.EQ in a real sheet.

RANK.EQ is taught in Data analysis with formulas, lesson 17: RANK and ranking within groups. Each lesson is a short, graded exercise like the one above.