Excel Rank Order Formula: How to Rank Data Correctly
In this article
To rank order data in Excel, use the RANK.EQ function (or the older RANK function), which assigns a number to a value based on its position relative to a list of other values. The basic formula structure is =RANK.EQ(number, ref, [order]), where "number" is the cell you want to rank, "ref" is the range containing all values, and "order" determines if the highest number is ranked first (0 or omitted) or the lowest number is ranked first (1). This allows you to instantly identify top performers, lowest costs, or leaderboard positions without manually sorting your entire dataset.
What You'll Need
- A computer with Microsoft Excel installed (works in all versions including Office 365, 2021, 2019, and 2016).
- A dataset containing a column of numerical values (e.g., sales figures, test scores, or race times).
- A blank column adjacent to your data where the rank results will be displayed.
Step-by-Step
- Organize Your Data: Ensure your numerical data is in a single column. For example, if you have a list of student scores in cells B2 through B11, ensure there are no text strings or errors within that range, as this can cause the formula to return an error.
- Select the Target Cell: Click on the empty cell where you want the first rank to appear (e.g., cell C2). This is usually the cell immediately to the right of your first data point.
- Enter the Basic Formula: Type
=RANK.EQ(B2, $B$2:$B$11)into the formula bar.- B2 is the specific value you are ranking.
- $B$2:$B$11 is the entire range of values. The dollar signs ($) create absolute references, which lock the range so it doesn't shift when you copy the formula down.
- Choose Your Order: Decide if you want the largest number to be #1 (Descending) or the smallest number to be #1 (Ascending).
- For Descending (Highest = 1): Leave the third argument blank or enter 0. Example:
=RANK.EQ(B2, $B$2:$B$11, 0). - For Ascending (Lowest = 1): Enter 1 as the third argument. Example:
=RANK.EQ(B2, $B$2:$B$11, 1). This is essential for things like race times where a lower number is a better result.
- For Descending (Highest = 1): Leave the third argument blank or enter 0. Example:
- Apply the Formula to All Rows: Hover your mouse over the bottom-right corner of cell C2 until the cursor turns into a small black cross (the Fill Handle). Double-click the cross or click and drag it down to cell C11. Excel will automatically adjust the first argument (B2, B3, B4...) while keeping the reference range locked.
- Verify the Results: Look at your rank column. If you used descending order, the highest number in your list should now have a "1" next to it.
Common Mistakes
The most frequent error when using the rank order formula is forgetting to use absolute references (the dollar signs) for the range. If you enter =RANK.EQ(B2, B2:B11) and drag it down, the second cell will become =RANK.EQ(B3, B3:B12). This means Excel is no longer looking at the whole list, but is instead shifting the search area downward, leading to incorrect rankings and often returning "1" for every single row because the value is being compared to a shrinking or shifted list.
Another common mistake is attempting to rank non-numerical data. The RANK.EQ function only works with numbers. If your cells contain numbers stored as text (often indicated by a small green triangle in the corner of the cell), the formula may ignore those cells or return a #VALUE! error. You must convert these to numbers using the "Convert to Number" warning or the VALUE function before ranking.
Users also frequently confuse the "order" argument. Entering a 1 when you want the highest value to be first will result in your top performer being ranked last. Always double-check if your goal is "Highest is Best" (0) or "Lowest is Best" (1).
Tips
Handling Ties: By default, RANK.EQ gives tied values the same rank. If two people have a score of 95 and are both ranked 1st, the next person will be ranked 3rd (skipping 2nd). If you want a "dense" rank (1, 1, 2 instead of 1, 1, 3), you cannot use RANK.EQ alone. You would need a more complex formula involving SUMPRODUCT or COUNTIFS.
Combining with Sorting: While the RANK formula tells you the position, it doesn't move the rows. To see the list in order, select your data and the rank column, go to the Data tab, and select Sort. Sort by the Rank column from Smallest to Largest to see your leaderboard in a clean, linear format.
Dynamic Ranges with Tables: If you frequently add new data to your list, convert your data range into an official Excel Table (Ctrl + T). When you use a table, you can reference the column name (e.g., =RANK.EQ([@Score], [Score])). This ensures that as you add new rows, the rank formula automatically extends to the new data without you having to manually update the range references.
Troubleshooting
If you see #N/A: This error typically occurs if the value you are trying to rank (the first argument) is not found within the reference range (the second argument). Check to ensure that the cell you are ranking is actually part of the range you selected. Also, ensure there are no hidden characters or spaces in the cells that might make a number look like text.
If the ranks are all the same: This is almost always caused by the lack of absolute references ($). Check your formula; if the range looks like B2:B11 instead of $B$2:$B$11, the range is shifting as you drag the formula down. Re-enter the formula with the dollar signs and drag it down again.
If the rank is not updating: Check if your Excel calculation mode is set to "Manual." Go to the Formulas tab, click Calculation Options, and ensure Automatic is selected. If it was on manual, your ranks will only update when you press F9 or save the file.
If the formula returns #VALUE!: This happens when the reference range contains an error value (like #DIV/0! or #REF!). The RANK.EQ function cannot ignore errors within the range; you must first clean the data or use the IFERROR function in the source column to replace errors with a neutral number or zero.
Frequently Asked Questions
What is the difference between RANK, RANK.EQ, and RANK.AVG?
RANK is the legacy version used in older Excel versions. RANK.EQ (Equal) is the modern replacement; it assigns the same rank to ties and skips the next rank. RANK.AVG assigns the average rank to ties. For example, if two people tie for 1st, RANK.EQ gives them both 1, while RANK.AVG gives them both 1.5.
Can I rank based on multiple criteria?
The standard RANK.EQ function only supports one column. To rank based on multiple criteria (e.g., rank by Score, then by Age if scores are tied), you must create a "helper column" that combines the values into a single decimal or use a complex array formula with the COUNTIFS function.
How do I rank only a specific category of data?
To rank items within a specific group (like ranking students only within their own classroom), you cannot use RANK.EQ. Instead, use the COUNTIFS function. The formula would look like =COUNTIFS(CategoryRange, CurrentCategory, ValueRange, ">"&CurrentValue)+1.
Does the order of the data matter before applying the formula?
No, the data does not need to be sorted for the RANK.EQ formula to work. The formula looks at the entire range and determines the position regardless of where the cell is located. However, sorting the results afterward makes the list much easier for humans to read.
Why does my rank skip numbers?
This is standard behavior for the "Competition Ranking" method used by RANK.EQ. If two items tie for 1st place, they both receive a 1, and the next available rank is 3. This indicates that two people are ahead of the person in 3rd place. To avoid this, you would need to use a different formula approach to achieve "Dense Ranking."