formulastreak

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

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.

Exam results · edit E2 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultE2 = 11
ABCDEFGH
1StudentClassHoursScoreHours rankFromGrade
2NoorA248110F
3MateoB566850D
4HanaA881360C
5OllieB3551070B
6ZaraA1093185A
7IvanB6726
8LeaA13912
9OmarB7775
10SaraA9882
11TheoB4619
12YukiA6706
13BeaB8843

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. 1. RANK.EQ: Gives the rank of C2 within $C$2:$C$13 (1 = the largest). Ties share a rank.
    • value = `C2`: the number to rank
    • range = `$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

ArgumentRequiredWhat it is
numberYesThe value to rank, such as C2.
refYesThe 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.
orderNo0 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

  • #N/A: The number isn't in the list, for example because the list range missed a row or the value is text.
  • #VALUE!: The number argument is text that can't be read as a number.

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.

Practise RANK.EQ on a live sheet

Lesson 44, Ranks, percentiles and bands (Unit 13, Statistics), has 5 graded exercises, checked instantly, with steps and hints when you're stuck. Pro