Download the Excel ranking practice workbook

Free Excel workbook

Download the Ranking Practice File

Get the exact workbook from the tutorial and practice along.

Get the Workbook

No spam. Unsubscribe anytime.

Let’s look at Excel’s RANK.EQ function. How can you rank your values in descending or ascending order and how can you rank duplicate values without skipping numbers in the sequence?

In our example, we have a list of sales managers and their sales.

Excel sales data table with sales manager names in column A and sales values in column B used as source data for ranking formulas

We want to create a report that displays the top 3 sales managers based on those numbers.

Excel Report sheet showing a Top 3 ranking dashboard layout with rank positions in column C and name output cells in column D

The problem is that several of the sales managers have the same sales value and will result in a 2-way or 3-way tie for the same rank position.

We want to display each of the names that result in a tie.

Excel Top 3 ranking report with three-way tie at rank 2 showing James Smith, Michael Brown, and Maria Martin in one cell

Ranking is ideal for grouping your data or bringing order to disordered data.  It’s when you want to compare one value against a set of values and determine how that single value ranks in respect to the full set of values.

How Does the RANK.EQ Function Work in Excel?

Using our previously examined list of sales managers and sales, we want to create a ranking of the sales in column C, but we do not wish to sort the original data.

It would be easy to sort the list by sales and then create a “helper column” of numbers that count from 1 forward.  The problem is that if we were to copy new values into the data set, the “helper column” would no longer be accurate.

Our solution will be to create in column C a formula using the RANK function.

You will notice when we begin typing the word “rank”, the IntelliSense service provides us with several options.  Per Microsoft…

  • RANK – This function has been replaced with one or more new functions that may provide improved accuracy and whose names better reflect their usage. Although this function is still available for backward compatibility, you should consider using the new functions from now on, because this function may not be available in future versions of Excel.
  • EQ – Returns the rank of a number in a list of numbers. Its size is relative to other values in the list; if more than one value has the same rank, the top rank of that set of values is returned. If you were to sort the list, the rank of the number would be its position.
  • AVG – Returns the rank of a number in a list of numbers: its size relative to other values in the list; if more than one value has the same rank, the average rank is returned.

We will use the RANK.EQ function for our solution.

A few notes about the RANK.EQ function:

  • This function works identically to the older RANK function.
  • If there are duplicates in your data resulting in 2-way or 3-way ties, each of those in the tied group will receive the same rank value. However, the list will then skip the number of following rank positions relative to the number of items in the prior tied group.
    Example: If the number 10 were to appear 3 times in a list, and its rank is position #5, the following item(s) in the list would begin in rank position #8.  The number 10 would consume slots #5, #6, and #7, even though they will all be labeled as #5.
Excel RANK.EQ results in column C showing duplicate values receiving the same rank with rank positions 3 and 4 skipped

Let’s select cell C5 and create the following formula:

=RANK.EQ(B5,$B$5:$B$24)
Excel RANK.EQ formula =RANK.EQ(B5,B$5:
B$24) entered in cell C5 with absolute reference on the full sales range

We will take the rank of the value in cell B5 and compare it against all other values in cells B5 through B24.  (Remember to press F4 and convert the B5:B24 reference to absolute $B$5:$B$24 so it will not change when the formula is copied down the table.)

You can add an optional argument to the formula to determine the ascending/descending order of the ranks.  If you omit this argument, descending order is the default behavior.

Syntax Tooltip: RANK.EQ function autocomplete showing the optional order argument for ascending or descending rank direction

The returned value of 2 indicates that James Smith’s sale of 9,000 is the second highest in the list.

Excel RANK.EQ result in cell C5 returning 2 indicating James Smith's sale of 9000 is the second highest value in the list

If we replicate the formula down the remainder of the table, we see that William Jones’ sale of 9,750 is the top-ranking sale of the set.

Excel column C filled with RANK.EQ results showing William Jones at rank 1 with 9750 and duplicate ranks visible in the list

Why Does RANK.EQ Skip Numbers When Duplicates Exist?

Observe that there are three sales reps with a sale value of 9,000; James Smith (row 5), Michael Brown (row 8), and Maria Martin (row 21).

Excel ranking table highlighting rows 5, 8, and 21 all showing rank 2 with ranks 3 and 4 missing due to RANK.EQ skip behavior

Notice we are also missing the ranks of #3 and #4.

This is the slot-use behavior we mentioned earlier. We will lose any number of slots commensurate with the number of “ties” in the list.

Let’s fix this behavior.

What Is the Difference Between RANK.EQ and RANK.AVG?

Excel has two dedicated rank functions: RANK.EQ and RANK.AVG. Both skip numbers when duplicates exist, but they handle ties differently.

RANK.EQ returns the top position in a tied group. If three values tie for rank 2, all three get rank 2. The next unique value gets rank 5 (positions 2, 3, and 4 are consumed by the tied group).

RANK.AVG returns the average position of the tied group. The same three tied values would get rank 3 each (the average of 2, 3, and 4). The next unique value still gets rank 5.

=RANK.AVG(B5, $B$5:$B$24)

Neither function produces dense ranking (rank without skipping) on its own. For that, use the SUMPRODUCT formula in the next section or the XMATCH formula for Microsoft 365.

When to use each:

  • RANK.EQ – Traditional competition ranking (Olympic medals, sports leagues). Tied athletes share the same gold medal.
  • RANK.AVG – Statistical analysis where average positions matter (non-parametric tests, percentile rankings).
  • Dense ranking formulas (below) – Internal reports, dashboards, and any scenario where you need every rank number to appear in sequence.

Note: The older RANK() function still works for backward compatibility but behaves identically to RANK.EQ. Microsoft recommends using RANK.EQ or RANK.AVG in all new workbooks.

How Do You Rank Without Skipping Numbers in Excel?

To ensure that John Johnson (row 6) receives a ranking of #3, we will use a more sophisticated formula, which oddly does not use any of the included RANK functions.

NOTE: We will create this formula and get it working but will hold off on dissecting its logic until later in the tutorial.

Select cell D5 and enter the following formula:

=SUMPRODUCT((B5<=$B$5:$B$24)/COUNTIF($B$5:$B$24,$B$5:$B$24))
Excel SUMPRODUCT formula =SUMPRODUCT((B5<=B$5:
B24)/COUNTIF(24)/COUNTIF(
24)/COUNTIF(B5:5:
5:B24,24,
24,B5:5:
5:B$24)) in cell D5 to rank without skipping numbers

Fill the formula down the remainder of the table.

Notice that rows 5, 8, and 21 have a rank of #2 while rows 6 and 10 have a rank of #3; rows 7 and 17 have a rank of #4.  We did not skip any rank positions.

Excel column D filled with SUMPRODUCT ranking results showing rows 5, 8, and 21 all at rank 2 with no skipped rank positions

How Do You Dense Rank with SORT, UNIQUE, and XMATCH in Modern Excel?

If you’re running Microsoft 365 or Excel 2021+, you can replace the SUMPRODUCT/COUNTIF formula with a single line that’s easier to read and doesn’t require any array math.

The Formula

Select cell F5 and enter:

=XMATCH(B5, SORT(UNIQUE($B$5:$B$24), 1, -1))
Rank duplicates without skipping numbers using the XMATCH, SORT, and UNIQUE formula to create a dense rank in Microsoft 365.

Copy the formula down from E5 to E24.

SUMPRODUCT and XMATCH dense ranking columns compared with identical results in Excel

The results match the SUMPRODUCT formula exactly. Same dense ranks, same handling of ties, zero skipped numbers.

How Does This Formula Work?

The formula works in three steps from the inside out.

Step 1: UNIQUE extracts the distinct sales values.

UNIQUE($B$5:$B$24)

This takes the 20 sales values in column B and returns only the unique ones. If 9,000 appears three times, UNIQUE returns it once.

UNIQUE function extracts distinct sales values from column B in Excel

Step 2: SORT arranges them in descending order.

SORT(UNIQUE($B$5:$B$24), 1, -1)

The 1 means sort by the first (and only) column. The -1 means descending order, so the highest sale appears first.

SORT and UNIQUE combined to create descending ranked list of unique sales values in Excel

Step 3: XMATCH finds the position.

=XMATCH(B5, SORT(UNIQUE($B$5:$B$24), 1, -1))

XMATCH searches for the current sale (B5 = 9,000) in the sorted unique list and returns its position. Since 9,000 is the second-highest unique value, XMATCH returns 2. That position IS the dense rank.

Every duplicate value finds the same position in the same sorted list, so all three 9,000 entries get rank 2. The next unique value (8,500) sits in position 3, so there’s no gap.

When Should You Use This Instead of SUMPRODUCT?

SUMPRODUCT / COUNTIFXMATCH / UNIQUE / SORT
Excel versionAll versionsMicrosoft 365 / Excel 2021+ only
ReadabilityLow (requires Boolean math explanation)High (reads like plain logic)
Performance on large datasetsSlower (evaluates full array per row)Faster (UNIQUE and SORT calculate once, XMATCH is a simple lookup)
Ctrl+Shift+Enter neededNo (SUMPRODUCT handles arrays)No (dynamic arrays handle it)
Works with ascending rankYes (change <= to >=)Yes (change -1 to 1 in SORT)
  • Use SUMPRODUCT/COUNTIF when your files are shared with people on Excel 2019 or earlier.
  • Use XMATCH/UNIQUE/SORT when everyone is on Microsoft 365 or Excel 2021+ and you want a formula that’s faster to write, easier to audit, and simpler to explain to colleagues.

Both approaches produce identical dense ranks and work with the TEXTJOIN dashboard in the next section.

Ascending Rank Version

To rank from smallest to largest instead, change the SORT order from -1 to 1:

=XMATCH(B5, SORT(UNIQUE($B$5:$B$24), 1, 1))

The smallest unique value gets rank 1. Everything else shifts accordingly.

How Do You Build a Top 3 Report That Shows Tied Names?

Our boss wants a summarized version of the table that displays the Top 3 sales rankings.  One of the requirements is that if there is a multi-way tie, all of the sales reps names for that rank must be displayed.

To derive this information, we need to create an array formula.  Luckily, it’s a very simple array formula.

On the “Report” sheet, select cell D6 and enter the following formula:

=IF(C6=Data!$D$5:$D$24,Data!$A$5:$A$24,"")
Excel Report sheet with IF array formula =IF(C6=Data!D$5:
D24,Data!24,Data!
24,Data!A5:5:
5:A$24,"") entered in cell D6 to match names to ranks

This formula will compare each item in cells D5:D24 and compare it to the rank number in cell C6.  If the value in cells D5:D24 matches, return the associated name in cells A5:A24.

When we hit ENTER, we don’t see any answers.

Excel Report sheet showing D6 displaying no visible result after entering the IF array formula because the first array value is blank

This is because we are returning an array (a list) of answers and we are seeing the first answer in the array.

Our best friend in this situation is the F9 key.  Highlight the formula in the Formula Bar and press the F9 key.  We will see all the answers returned from the calculation.

Excel formula bar with IF formula evaluated using F9 showing the full array result with William Jones as the only non-blank name

Notice that the first answer is “blank”; that’s why there was no visible answer when we hit ENTER.

We see that “William Jones” is the only real answer in the list.  What good is the answer if we can’t see the answer in the cell?

REMEMBER: Press the Escape key (ESC) so you do not permanently change your formula.

How Does TEXTJOIN Display Multiple Names for the Same Rank?

We will modify the existing formula in cell D6 and use a relatively new function in Excel called TEXTJOIN.

TEXTJOIN is available in Office 2019 and Office 365.

Modify the formula as follows:

=TEXTJOIN(", ", TRUE,IF(C6=Data!$D$5:$D$24,Data!$A$5:$A$24, ""))
Excel TEXTJOIN array formula =TEXTJOIN(", ",TRUE,IF(C6=Data!D$5:
D24,Data!24,Data!
24,Data!A5:5:
5:A$24,"")) entered in cell D6 on the Report sheet

The TEXTJOIN function will take all the answers generated by the IF function and concatenate them together into an unbroken list of names.

The TEXTJOIN function combines the text from multiple cells/ranges and includes a delimiter you specify between each text value that will be combined.  We will provide a “comma-space” to act as our delimiter.

The TEXTJOIN function also allows us to determine how to handle blank cells/ranges.  Since we only want the items in the array that contain names, and not the blank items, we will use the “TRUE” option to invoke this behavior.

Because this is an array formula, we need to press CTRL-SHIFT-ENTER to commit the formula to the cell.  If you have one of the most recent versions of Excel that utilizes Dynamic Arraysyou only need to press ENTER; it is not necessary to press CTRL-SHIFT-ENTER.

This produces the following formula (notice the opening and closing braces):

{=TEXTJOIN(“,”,TRUE,IF(C6=Data!$D$5:$D$24,Data!$A$5:$A$24,””))}
Excel Report sheet cell D6 showing "William Jones" as the rank 1 result after TEXTJOIN array formula committed with Ctrl+Shift+Enter

If we copy the formula down to cells D7 and D8 we see the following results.

Excel Top 3 report with TEXTJOIN formula filled to D7 and D8 showing rank 2 with three tied names and rank 3 with two tied names

If it helps further your understanding of what is occurring, select cell D7, highlight the IF portion of the formula and press the F9 key.

Excel formula bar with IF portion of TEXTJOIN formula evaluated using F9 showing three names and many blank entries for rank 2

We see that for the #2 rank position we have 3 names and many blanks.  The TEXTJOIN function has ignored all the empty items and merged all the names, separating them with comma-spaces to make the answer more presentable.

How Do You Verify the Rankings Update Dynamically?

If we return to the table of sales and change the value of cell B5 to 10,000, the rankings will update.

Excel data table after changing B5 to 10000 showing updated SUMPRODUCT rankings with James Smith now ranked 1 in column D

Returning to the Report sheet, we see that “James Smith” occupies the #1 rank while the other items from the original list have shifted down one level in the ranks.

Excel Report sheet after data update showing James Smith at rank 1 and original rank 2 and 3 names shifted down accordingly

How Does the SUMPRODUCT/COUNTIF Dense Ranking Formula Work?

When you build complex formulas, it’s often a helpful strategy to build the formula in pieces using separate cells or columns.  This allows us to focus on solving one problem at a time.  Once we have all the problems solved, we can combine all the pieces into a single solution.

It is also helpful to focus on solving the problem for a single item/record in the data and then replicate the result to the remaining items/rows when completed.

Returning to the sheet with our table, select cell F5 and enter the following formula:

=B5<=B5:B24
Excel cell F5 showing TRUE as the first result of the array formula =B5<=B5:B24 comparing B5 against all values in the sales range

The result will be “TRUE” because what we are seeing is the first answer in an array of answers.  Since the first item compared is B5 to itself, the answer is “TRUE”.

If we highlight the formula and press the F9 key, we see all the TRUE/FALSE responses where the contents of B5 are compared to all the values in cells B5:B24.

Excel formula bar with =B5<=B5:B24 evaluated using F9 showing the full TRUE and FALSE array for all 20 comparisons against B5

Because this is difficult to compare; the TRUE/FALSE responses to the rows in the table, we will perform a little trick to list the TRUE/FALSE responses on the rows next to their respective evaluations.

  1. Press the ENTER key to preserve the TRUE/FALSE responses in the Formula Bar.
  2. Highlight cells F5:F24.
  3. Click in the Formula Bar to reenter edit mode.
  4. Press CTRL-SHIFT-ENTER.

This will have the effect of cascading the TRUE/FALSE responses down the rows next to their evaluated sales.

Excel column F showing the TRUE and FALSE comparison results cascaded down rows F5:F24 after Ctrl+Shift+Enter array entry

The next step to examine is the use of the COUNTIF function.  Returning to our “work on one piece at a time” strategy, select cell G5 and enter the following formula.

=COUNTIF(B5:B24,B5:B24)
Excel cell G5 with COUNTIF formula =COUNTIF(B5:B24,B5:B24) showing how many times each sales value appears across the full list

If we highlight the finished formula and press the F9 key, we see the following list of values.

Excel formula bar with COUNTIF formula evaluated using F9 showing the count array where 9000 appears 3 times and 9750 appears once

Using the same trick as before,

  1. Press the ENTER key to preserve the list of values responses in the Formula Bar.
  2. Highlight cells G5:G24.
  3. Click in the Formula Bar to reenter edit mode.
  4. Press CTRL-SHIFT-ENTER.

What each number is telling us is how many times the current row’s sales occurs in the list.  Example: The number 9,000 occurs 3 times in the list, and each time it occurs we encounter a number 3 as the answer for that row.

Excel column G filled with COUNTIF occurrence counts showing 3 next to each row where the sales value of 9000 appears in the list

In the final combined calculation, the results of the COUNTIF function remain the same for each use throughout the table, but the list of TRUE/FALSE responses from the IF will be different for each row in the table.

The next step is to divide each TRUE/FALSE in column F by the value in column G.

Whenever Excel uses a TRUE or FALSE as part of a mathematical operation, TRUE is interpreted as a 1 while False is interpreted as a 0 (zero).

Looking at the first evaluation a TRUE (1) divided by a 3 yields 0.333333.

Excel helper column showing TRUE divided by COUNTIF result where TRUE equals 1 so 9000 with count 3 yields 0.333 per occurrence

When we fill the formula down the list, we see the following results.

Excel helper column filled down showing all division results with the sum of the entire column equaling 2 the rank for James Smith

The sum of all the results is 2.

Finally, why are we using the SUMPRODUCT function?  The SUMPRODUCT function is used as a container to store all the intermediate calculations and then add them all together for the result.

A bonus of the SUMPRODUCT is that it does not require the use of a CTRL-SHIFT-ENTER.  SUMPRODUCTs can handle arrays natively without any special instructions during execution.

How Do You Assign Unique Ranks to Tied Values?

If you need a list of completely unique ranks, where ties are spread across rank positions (i.e. a 3-way tie for 2nd place would occupy rank positions 2, 3, and 4), click in cell E5 and enter the following formula.

=RANK.EQ(B5, $B$5:$B$24)+COUNTIF($B$5:B5, B5)-1
Excel RANK.EQ bonus formula =RANK.EQ(B5,B$5:
B24)+COUNTIF(24)+COUNTIF(
24)+COUNTIF(B$5
:B5,B5)-1 in cell E5 to assign unique ranks across tied values

The result would be as follows:

Excel column E showing unique rank results with tied values spread across sequential positions so no two rows share the same rank

Frequently Asked Questions

Why does RANK.EQ skip numbers when there are duplicates?

RANK.EQ assigns the same rank to all tied values but then skips the corresponding number of positions. If three values tie for rank 2, the next value gets rank 5 because ranks 2, 3, and 4 are all consumed by the tied group. This is called competition ranking, where tied items share the highest rank in the group.

How do you rank in Excel without skipping numbers?

Use the SUMPRODUCT/COUNTIF formula: =SUMPRODUCT((B5&lt;=$B$5:$B$24)/COUNTIF($B$5:$B$24,$B$5:$B$24)). This creates a dense ranking where tied values share the same rank and the next unique value gets the next consecutive number with no gaps. No Ctrl+Shift+Enter needed. In Microsoft 365 or Excel 2021+, use =XMATCH(B5, SORT(UNIQUE($B$5:$B$24), 1, -1)) for a cleaner alternative.

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

RANK.EQ returns the top position in a tied group. If three values tie for rank 2, all three get rank 2. RANK.AVG returns the average position of the tied group. The same three values would get rank 3 (the average of 2, 3, and 4). Both functions skip subsequent rank numbers. Neither produces dense ranking without a workaround formula.

How do you list all names that share the same rank?

Use TEXTJOIN with an IF array formula: =TEXTJOIN(", ",TRUE,IF(C6=RankRange,NameRange,"")). TEXTJOIN concatenates all matching names separated by commas and ignores blanks. In Excel versions without dynamic arrays, press Ctrl+Shift+Enter. In Microsoft 365 or Excel 2021+, press Enter.

How do you create unique ranks for tied values in Excel?

Use =RANK.EQ(B5,$B$5:$B$24)+COUNTIF($B$5:B5,B5)-1. The growing COUNTIF range ($B$5:B5 instead of $B$5:$B$24) counts how many times the current value has appeared so far. Each duplicate gets an incrementally higher rank. A 3-way tie for rank 2 produces ranks 2, 3, and 4 instead of three identical rank 2s.

Does RANK.EQ work with text values?

No. RANK.EQ, RANK.AVG, and the older RANK function only work with numeric values. If you need to rank text (such as alphabetical ordering), use COUNTIF to count how many text values are less than the current value: =COUNTIF($A$5:$A$24,"&lt;"&A5)+1. This returns an alphabetical rank position.

Download the Practice Workbook

Ranking practice workbook thumbnail

FREE EXCEL WORKBOOK

Get the Ranking Practice File

  • All 3 ranking formulas ready to copy into your own data
  • Top 3 dashboard built with TEXTJOIN, ready to customize
  • Tiebreaker formula for fully unique ranks
Send Me the Workbook

Free. Instant access. No spam.

Leila Gharani

Founder of XelPlus and ten-time Microsoft MVP. Leila helps over 500,000 professionals master Excel, Power BI, and data automation through practical, real-world training.