What RANK.EQ does

RANK.EQ gives a number’s rank in a list: 1 for the largest value, 2 for the next and so on. =RANK.EQ(B2,$B$2:$B$7) says where the sales in B2 stand among the sales in B2:B7, and filled down a column it ranks every row, highest to lowest. Add a third argument of 1 to rank from lowest to highest.

It suits leaderboards and league tables, such as ranking stores by sales or suppliers by price. The ranks follow the data: change a number and every rank in the list updates, without sorting anything.

Equal values share a rank, and the ranks after them move down to make room. Two stores tied for first are both 1, and the next store is 3. RANK is the older name for the same function and gives the same results. RANK.AVG ranks ties differently.

Syntax

=RANK.EQ(number, ref, [order])
Arguments in square brackets are optional; the rest are required.
numberRequired
The value to rank, usually the cell on the same row, such as B2.
refRequired
The whole list to rank it in, locked with dollar signs so it stays put when you fill the formula down: $B$2:$B$7. Text and empty cells in it are ignored.
orderOptional
Optional. Leave it out, or use 0, to rank the largest value 1. Use 1 to rank the smallest value 1, as for prices or times where less is better.

Example: rank stores by sales, highest first

A regional manager ranks six stores on the month’s sales. The formula in C2 is filled down to C7.

Austin and Tucson tie for first with 51,900, so no store is ranked 2. In C2, =RANK.EQ(B2,$B$2:$B$7) returns 3.

Read it as: rank B2 within the locked list B2:B7, largest first. The list keeps its dollar signs as the formula fills down, so every row is ranked against the same six stores.

Example: rank bids from lowest to highest

A purchasing team compares four bids for the same contract, where the cheapest is best. A third argument of 1 makes the smallest value rank 1.

Supplier B's €16,950 is the lowest bid, so it ranks 1. In C2, =RANK.EQ(B2,$B$2:$B$5,1) returns 3.

Rank without ties

A prize list or a ranked report sometimes needs every rank to be different. Add a count of how many times the value has already appeared above the current row: =RANK.EQ(B2,$B$2:$B$7)+COUNTIF($B$2:B2,B2)-1.

The COUNTIF range starts locked at B2 and grows as the formula fills down, so the first of two equal values keeps its rank and the second gets the next one. On the stores above, Austin stays 1 and Tucson, lower in the list, becomes 2.

RANK.EQ vs RANK and RANK.AVG

RANK is the older name for the same calculation, kept so older workbooks still work. New formulas should use RANK.EQ, which takes the same arguments and gives the same results.

RANK.AVG differs only for ties. It gives each tied value the average of the places they fill, so Austin and Tucson, sharing first and second place, both get 1.5 with =RANK.AVG(B3,$B$2:$B$7). Use it when tied values should split their places evenly.

Common mistakes

  • =RANK.EQ(B2,B2:B7) filled down without dollar signs ranks each row against a shorter list that slides down with it. Boise, 5th of 6, comes out 3rd. Lock the list: $B$2:$B$7.
  • =RANK.EQ(B2,$B$2:$B$5,1) ranks the smallest value 1. When the highest value is best, as for sales, leave out the third argument.
  • #N/A means the number isn’t in the list, which happens when the number cell sits outside the ranked range or a typed-in figure doesn’t match any value exactly.
  • A figure stored as text in the list is ignored, so the ranks of the others close up around it. Convert the column to numbers before you rank it.

Frequently asked questions

How do I rank from highest to lowest in Excel?

Use RANK.EQ without a third argument: =RANK.EQ(B2,$B$2:$B$7) ranks the largest value 1. Fill it down the column, keeping the dollar signs on the list.

How do I rank from lowest to highest?

Give 1 as the third argument: =RANK.EQ(B2,$B$2:$B$5,1) ranks the smallest value 1, which suits prices, costs and times.

How do I rank without duplicate ranks?

Add a running count of the value to the rank: =RANK.EQ(B2,$B$2:$B$7)+COUNTIF($B$2:B2,B2)-1. The first of two equal values keeps its rank, and the second gets the next one.

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

RANK and RANK.EQ give the same results, and tied values share the top rank of their group. RANK.AVG gives tied values the average of their places, such as 1.5 for two values tied for first. RANK is the older name, kept for compatibility.

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

Count the larger values in the same group and add 1: =COUNTIFS($A$2:$A$6,A2,$C$2:$C$6,">"&C2)+1 ranks the sales in C2 among the rows of the same region as A2.