Templates, guides & honest tool reviews for small business

Sunday, November 29, 2026

Rank in Excel: RANK.EQ, RANK.AVG, Ties and Ranking by Group

Rank in Excel with RANK.EQ and RANK.AVG
Illustration: Rank in Excel

To rank in Excel, use the RANK.EQ function: =RANK.EQ(B2, $B$2:$B$20, 0) gives the position of the value in B2 within the list, with 1 for the largest. This guide explains RANK.EQ and RANK.AVG, how to rank from smallest to largest, how ties work, how to rank within a group and how to build a top 3 list. The sample data is made up.

RANK.EQ syntax

=RANK.EQ(number, ref, [order])

  • number is the value you want to rank.
  • ref is the list of values to compare against. Lock it with dollar signs so it does not move when you copy the formula down.
  • order is optional. 0 or left out ranks the largest value as 1. Any other number, such as 1, ranks the smallest value as 1.

The older RANK function still works and gives the same result as RANK.EQ. Microsoft keeps it for compatibility.

RANK.EQ syntax in Excel
Number, ref, order (illustration).

Rank from largest to smallest

With sales in B2:B20, type this in C2 and fill down:

=RANK.EQ(B2, $B$2:$B$20, 0)

The dollar signs are an absolute reference. If they are new to you, read our guide to the absolute reference in Excel.

Rank from largest to smallest in Excel
Made-up sales (illustration).

Rank from smallest to largest

Change the last argument to 1. This suits golf scores, delivery times or costs, where a lower number is better:

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

What happens with ties

RANK.EQ gives equal values the same rank and skips the next numbers. If two people tie for 2nd, both get 2 and the next person gets 4. RANK.AVG gives tied values the average of their positions, so the two tied for 2nd would both get 2.5:

=RANK.AVG(B2, $B$2:$B$20, 0)

Ties in Excel: RANK.EQ versus RANK.AVG
Two values tied for 2nd (illustration).

Break ties with a second column

To give every row a unique rank, add COUNTIF, which counts earlier rows with the same value:

=RANK.EQ(B2, $B$2:$B$20, 0) + COUNTIF($B$2:B2, B2) - 1

The first of a tie keeps its rank and the next gets one higher. This ties by row order, so decide whether that is fair for your data.

Rank within a group

RANK has no condition. To rank sales inside each region, count the values in the same region that are larger:

=COUNTIFS($A$2:$A$20, A2, $B$2:$B$20, ">"&B2) + 1

Here column A holds the region. The formula counts how many rows in the same region have a higher value and adds 1. Our COUNTIFS guide explains the pieces.

Rank within a group in Excel using COUNTIFS
Rank inside each region (illustration).

Show the top 3 with a lookup

Use LARGE to get the top values and XLOOKUP to find the names. For the largest value: =LARGE($B$2:$B$20, 1), and for its name =XLOOKUP(LARGE($B$2:$B$20,1), $B$2:$B$20, $A$2:$A$20). Change 1 to 2 and 3 for the next places. If two values tie, XLOOKUP returns the first name only. See the XLOOKUP guide for the syntax.

Common mistakes

  • Forgetting the dollar signs. The ref range slides down and ranks come out wrong.
  • Text in the range. Numbers stored as text are ignored.
  • Blank cells. Blanks are ignored in the list, but a blank number returns an error.
  • Wrong order. Check whether 1 should be the highest or the lowest.

Questions and answers

What is the difference between RANK and RANK.EQ?

They return the same result. RANK is the older name, kept for older workbooks.

How do I rank without changing the order of my data?

A rank formula in a helper column leaves the rows where they are. Sort the data only if you want to.

Is there a RANK function in Google Sheets?

Yes. Google Sheets has RANK, with the same arguments. In Sheets, sort a list with the SORT function to see the order.

Can I rank dates?

Yes. Dates are numbers, so a later date is a larger value. Use order 1 to rank the earliest date as 1.

العربية