Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Ranking in Excel: How to Use RANK.EQ and RANK.AVG

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To rank data in Excel, use the RANK.EQ function, which assigns a number to a value based on its position relative to a list of other values. For example, if you have a list of sales figures, the highest number can be ranked as 1, the second highest as 2, and so on. This allows you to quickly identify top performers or bottom outliers without manually sorting the entire dataset.

What You'll Need

  • Microsoft Excel (any modern version including Office 365, Excel 2021, 2019, or 2016).
  • A dataset containing a column of numerical values (e.g., test scores, revenue, or race times).
  • A blank column adjacent to your data where the rank numbers will be displayed.

Step-by-Step

  1. Prepare Your Data: Ensure your data is organized in a clean table. For this guide, assume your numerical values are in column B, starting from cell B2 and ending at B11. Your labels (like names or dates) should be in column A.
  2. Select the Target Cell: Click on the first empty cell where you want the rank to appear (for example, cell C2).
  3. Enter the RANK.EQ Formula: Type the following formula into the cell: =RANK.EQ(B2, $B$2:$B$11, 0).
  4. Understand the Formula Arguments:
    • Number (B2): This is the specific value you want to find the rank for.
    • Ref ( $B$2:$B$11): This is the entire range of numbers you are comparing the first value against. The dollar signs ($) are critical; they create an "absolute reference," meaning that when you copy the formula down, Excel will always look at the same range of cells rather than shifting the range downward.
    • Order (0): This tells Excel how to rank. A 0 (or leaving it blank) ranks in descending order, meaning the largest value is 1. A 1 ranks in ascending order, meaning the smallest value is 1.
  5. Apply the Formula to the List: Press Enter to see the rank for the first item. To apply this to the rest of your list, hover your mouse over the bottom-right corner of cell C2 until a small black cross (the Fill Handle) appears. Click and drag the handle down to cell C11.
  6. Verify the Results: Check the top and bottom of your list to ensure the highest (or lowest) numbers are correctly assigned the rank of 1.
  7. Optional: Sort by Rank: If you want the list to appear in order of rank, highlight your entire data range (A2:C11), go to the Data tab, click Sort, and select the Rank column (Column C) as the sort key, ordering from Smallest to Largest.

Common Mistakes

The most frequent error when ranking in Excel is forgetting to use absolute references for the range. If you use B2:B11 instead of $B$2:$B$11, the range will shift as you drag the formula down. For the second row, Excel will look at B3:B12; for the third, B4:B13. This results in incorrect rankings because the formula is no longer comparing the number against the full set of data, but rather a shrinking subset of it.

Another common mistake is applying the wrong "Order" argument. Users often use 0 when they actually need 1. For instance, if you are ranking golf scores or race times, a lower number is better. In these cases, using 0 will rank the slowest person as number 1, which is logically incorrect for those specific metrics.

Some users also try to rank non-numerical data, such as text strings. The RANK functions only work with numbers. If your column contains numbers stored as text (often indicated by a small green triangle in the corner of the cell), the formula will return a #N/A error because Excel cannot mathematically compare a text string to a number.

Tips

If you have a very large dataset, consider converting your data range into an official Excel Table (Select data > Ctrl + T). When you enter a RANK.EQ formula in a Table, Excel automatically applies the formula to the entire column and manages the range references more intuitively, often removing the need for manual dollar-sign absolute references.

To handle "Ties" differently, you can use RANK.AVG instead of RANK.EQ. While RANK.EQ gives two people with the same score the same rank (e.g., both are ranked 2nd, and the next person is ranked 4th), RANK.AVG calculates the average rank for the tie. If two people tie for 2nd, RANK.AVG will assign them both a rank of 2.5.

For a more modern approach in Office 365, you can use the SORT and SEQUENCE functions combined to create dynamic rankings that update automatically as you add new data, though the RANK.EQ method remains the industry standard for simplicity and compatibility across all Excel versions.

Troubleshooting

If you see a #N/A error: This typically means the value you are trying to rank is not found within the reference range you provided. Double-check that your first argument (the number) is actually part of the second argument (the range). Also, ensure there are no hidden characters or spaces in your cells that are causing Excel to treat numbers as text.

If the ranks are all "1": This usually happens because the reference range was not locked with dollar signs. As the formula was dragged down, the range moved, and eventually, the number was being compared only to itself, making it the "top" value in its own tiny range. Undo the fill, add the $ signs to the range, and drag the formula down again.

If the ranking order is backward: Check the third argument of your formula. If it is 0, the largest number is 1. If it is 1, the smallest number is 1. Switch the 0 to a 1 (or vice versa) to flip the ranking logic.

If the formula doesn't update when values change: Ensure your workbook is set to Automatic Calculation. Go to the Formulas tab > Calculation Options and make sure Automatic is selected. If it is set to Manual, you must press F9 to refresh the ranks.

Frequently Asked Questions

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

RANK is an older function kept for compatibility with legacy versions of Excel. RANK.EQ (Equal) is the modern replacement; it assigns the same rank to tied values. RANK.AVG (Average) assigns the average of the ranks that tied values would have occupied.

Can I rank data based on multiple criteria?

The standard RANK.EQ function only handles one column. To rank based on multiple criteria (e.g., rank by Score, then by Age as a tie-breaker), you typically need to create a "helper column" that combines the values into a single decimal number or use a complex SUMPRODUCT formula.

How do I rank only a specific category of items?

To rank items within a group (e.g., ranking students within their specific classrooms), you cannot use RANK.EQ alone. You would use the COUNTIFS function, which allows you to count how many items are greater than the current item while also matching a specific category label.

Does ranking change the original data?

No, the RANK functions do not move or change your original numbers. They simply output a new number in a different cell that represents the position of the original value. Your original data remains exactly as it was entered.

Can I use ranking with dates?

Yes. Excel stores dates as serial numbers. Therefore, you can rank dates to find the oldest (smallest number) or newest (largest number) date in a list using the same RANK.EQ logic.