Compatibility function

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

Older function. RANK still works, but for new workbooks use RANK.EQ.

Syntax

RANK(number, ref, [order])
ArgumentWhat it means
numberRequiredThe value whose rank you want.
refRequiredThe range of numbers to rank against. Non-numbers are ignored.
orderOptional0 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

C2fx=RANK(B2, $B$2:$B$6)
ABC
1RepRevenue
2Ana482003
3Ben51900
4Cara39750
5Dev51900
6Eli45300

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

C3fx=RANK(B3, $B$2:$B$6)
ABC
1RepRevenue
2Ana48200
3Ben519001
4Cara39750
5Dev51900
6Eli45300

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

C3fx=RANK(B3, $B$2:$B$5, 1)
ABC
1RunnerTime (s)
2Kim12.4
3Lou11.92
4Max12.8
5Ned11.7

Result: 2

With order = 1 the smallest value ranks first. Ned (11.7) is 1st and Lou (11.9) is 2nd.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

Common errors and how to fix them

ErrorWhy it happensFix
#N/Anumber 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.

LanguageFunction name
DanishPLADS
DutchRANG
FinnishARVON.MUKAAN
FrenchRANG
GermanRANG
HungarianSORSZÁM
ItalianRANGO
Norwegian (Bokmål)RANG
PolishPOZYCJA
Portuguese (Brazil)ORDEM
Portuguese (Portugal)ORDEM
RussianРАНГ
SpanishJERARQUIA
SwedishRANG

Recipes that use RANK