Smart Systems for Home

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

How to Apply RANK Formula in Excel: Step-by-Step

· 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

The RANK function in Excel returns the position of a number within a list of numbers, telling you whether that value is the largest, second largest, third largest, and so on (or smallest, if you prefer). To use it, type =RANK(number, ref, [order]) into a cell, where number is the value you want to rank, ref is the range containing all the numbers to compare against, and order is 0 or omitted for descending rank (largest = 1) or 1 for ascending rank (smallest = 1). Press Enter and the rank appears. This works in Excel for Microsoft 365, Excel 2019, 2016, and most earlier versions; the newer RANK.EQ function behaves identically and is the recommended replacement in modern Excel, but RANK still works for backward compatibility.

What You'll Need

  • Excel installed on your computer (desktop) or access to Excel for the web. The steps below apply to the desktop app; the web version works the same way for the formula itself.
  • A column or row of numeric values that you want to rank. The numbers should be in a single contiguous range, with no blank cells inside it (blanks are ignored but can make results confusing).
  • A cell where you want the rank to appear, ideally next to the number being ranked.

Step-by-Step

  1. Set up your data. Put the numbers you want to rank in a single column, for example A2:A10. Leave the header in A1 if you have one. Make sure the range contains only numbers (no text, no spaces).
  2. Click the cell where you want the first rank. For example, click B2 if your first number is in A2.
  3. Type the RANK formula. Enter =RANK(A2, $A$2:$A$10, 0) and press Enter. The 0 at the end means descending order (largest number gets rank 1). If you want the smallest number to get rank 1, use 1 instead of 0.
  4. Use absolute references for the range. Notice the dollar signs in $A$2:$A$10. They lock the range so that when you copy the formula down, it always compares against the full list. Without them, the range would shift and give wrong ranks.
  5. Copy the formula down. Drag the fill handle (the small square at the bottom-right of the cell) down to B10, or copy B2 and paste it into B3:B10. Each row now shows the rank of its number within the whole list.
  6. Check for ties. If two numbers are identical, RANK gives them the same rank and skips the next rank (e.g., two values tied for 2nd means no 3rd; the next value gets 4th). This is standard behaviour. If you need unique ranks, use RANK.EQ plus a tie-breaker like COUNTIF, or switch to RANK.AVG which assigns the average rank to ties.
  7. Adjust for ascending order if needed. If you are ranking times, scores where lower is better, or any list where smallest should be rank 1, change the last argument to 1. For example: =RANK(A2, $A$2:$A$10, 1).
  8. Optional: use RANK.EQ instead. In newer Excel versions, RANK.EQ is the direct replacement and works exactly the same way: =RANK.EQ(A2, $A$2:$A$10, 0). It is not required, but Microsoft recommends it for future compatibility.

Common Mistakes

  • Forgetting absolute references. Using A2:A10 instead of $A$2:$A$10 means the range shifts as you copy down, producing incorrect ranks for lower rows. Always lock the range with dollar signs.
  • Including the rank column in the reference. If you put ranks in column B and then use B2:B10 as the ref, you are ranking the ranks. The ref must point only to the original numbers.
  • Mixing text and numbers. RANK ignores text values, but if your range contains numbers stored as text (often left-aligned), they may be excluded from ranking. Convert them to real numbers first (e.g., using Text to Columns or VALUE).
  • Using the wrong order argument. Omitting the third argument defaults to descending (largest = 1). If you expect smallest = 1 and forget to add 1, your ranks will look reversed.
  • Expecting unique ranks with duplicates. RANK and RANK.EQ give tied values the same rank and leave gaps. If you need 1, 2, 3, 4 with no gaps, you need a different approach (see Tips).

Tips

  • To rank within a filtered list only, use SUBTOTAL or AGGREGATE instead of RANK, because RANK always considers all values in the range, including hidden rows.
  • For unique ranks with ties, combine RANK with COUNTIF: =RANK(A2,$A$2:$A$10,0)+COUNTIF($A$2:A2,A2)-1. This gives each duplicate a distinct rank based on order of appearance.
  • Use RANK.AVG if you want tied values to receive the average of the ranks they would have occupied (e.g., two tied for 2nd get 2.5).
  • Format the rank column as a number with zero decimal places to avoid showing decimals from RANK.AVG.
  • If you are ranking across multiple columns, use a single range like $A$2:$C$10 and adjust the number argument accordingly.

Troubleshooting

  • #N/A error: The number you are ranking is not found in the ref range. Check for typos, extra spaces, or numbers stored as text.
  • #VALUE! error: The number argument is non-numeric, or the ref range contains non-numeric values that Excel cannot handle. Ensure all cells in the range are numbers or blank.
  • Ranks look wrong after copying: You probably used relative references. Change the ref to absolute ($A$2:$A$10).
  • All ranks are 1: The ref range likely contains only one cell, or you are ranking a single value against itself. Expand the range to include all values.
  • Blank cells in the range: RANK ignores blanks, but if your number is blank, it returns #N/A. Fill blanks or adjust the range.
  • Formula not calculating: Check that calculation is set to Automatic (Formulas > Calculation Options > Automatic). Also press F9 to force recalc.

Frequently Asked Questions

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

RANK and RANK.EQ are identical: they give tied values the same rank and skip subsequent ranks. RANK.AVG gives tied values the average of the ranks they would have received. RANK is kept for compatibility; RANK.EQ is the modern equivalent.

Can I rank only visible rows in a filtered list?

No, RANK always includes hidden rows. Use SUBTOTAL with function number 3 (COUNTA) or AGGREGATE to rank only visible cells, or sort/filter your data first and then apply RANK to the filtered subset if you copy it elsewhere.

How do I rank in ascending order (smallest = 1)?

Add 1 as the third argument: =RANK(A2, $A$2:$A$10, 1). Omitting it or using 0 gives descending order.

Why does RANK return the same rank for duplicate values?

That is by design: tied values share the same rank, and the next rank is skipped. If you need unique ranks, use the COUNTIF adjustment shown in Tips.

Does RANK work in Excel for the web and Excel mobile?

Yes, RANK and RANK.EQ are supported in Excel for the web and the Excel mobile app. The formula syntax is the same.

Can I use RANK across multiple sheets?

Yes, but the ref must be a 3D reference or a defined name that includes all relevant sheets. For example, =RANK(A2, Sheet1:Sheet3!$A$2:$A$10, 0) ranks A2 against the same range on Sheet1 through Sheet3. This can be tricky; test carefully.