Smart Systems for Home

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

How to Calculate Rank in Excel: RANK, RANK.EQ and Ties

· 7 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 calculate a rank in Excel, put your scores in one column and use the RANK function in the cell beside them: =RANK(number, ref, [order]). Put the value you want to rank in number, select the full range of scores as ref, and leave order blank (or 0) for a "largest is 1" ranking, or enter 1 for "smallest is 1". In current versions of Excel the RANK function still works, but it has been replaced by RANK.EQ, which produces identical results and is the safer choice for new sheets. If two values are equal, both get the same rank and the next rank is skipped, so two second places make the next value fourth.

What You'll Need

  • Excel for Microsoft 365, Excel 2021, 2019, 2016, or Excel for the web (the steps are the same in all of them).
  • A column of numeric scores to rank, with no blanks and no text mixed in.
  • One spare column beside the scores for the rank formula.
  • Optional: the RANK.AVG or COUNTIF functions for tie handling and conditional ranks.

Step-by-Step

  1. Lay out your data with column headers, for example names in column A and scores in column B, starting on row 2. Ranks are calculated from numbers only, so make sure the score column contains no stray text, dashes or spaces.
  2. Click the first empty cell in the column beside the top score so the rank and the score sit on the same row, for example C2 next to B2.
  3. Type =RANK.EQ(B2,$B$2:$B$101,0) and press Enter. Replace the range with your own last row. The dollar signs are essential: the ref argument must be absolute so it stays fixed when you copy the formula down.
  4. Press Enter. The cell now shows the position of that score within the list, where the highest score is 1.
  5. Grab the fill handle (the small square at the bottom-right corner of the cell) and drag down to the last row, or double-click the fill handle to fill automatically to the end of the adjacent data. Every row now has its own rank.
  6. For a ranking where the smallest value should be 1 (as with race times, golf scores, or error counts), change the third argument to 1: =RANK.EQ(B2,$B$2:$B$101,1). Brief note on menu labels: the function names in this guide match current and recent versions; menu and ribbon wording can differ slightly by version, device or region.
  7. Check the result against a couple of values you can verify by eye. Sort a copy of the data descending and compare the first few positions to your rank column.
  8. If you prefer a dialog, click the formula cell, then use the Insert Function button beside the formula bar, search for RANK, and fill in Number, Ref and Order in the dialog. This is useful for spotting argument order mistakes, because RANK and RANK.EQ take exactly these three arguments.
  9. Handle ties deliberately if it matters. RANK and RANK.EQ assign the same (highest) rank to equal values and skip the following ranks. RANK.AVG, written =RANK.AVG(B2,$B$2:$B$101,0), gives equal values the average of the ranks they would have taken, so two tied second places become 2.5.
  10. If you need unique positions with no gaps, add a tie-breaker. One common approach is a small count adjustment, such as ranking the scores and then breaking ties by row order, using a helper column that adds a tiny, row-based increment to each score before ranking. Keep the increment smaller than the smallest real difference between scores so it cannot reorder the true results.

Common Mistakes

Using a relative range. If you write =RANK.EQ(B2,B2:B101,0) without dollar signs and drag it down, the range slides with the formula and later rows return #N/A or nonsense ranks. Always lock the range with $ signs, or convert the data to an Excel Table and refer to the structured column reference instead.

Mixing text and numbers. RANK ignores text and blanks in the range, but any score stored as text, usually left-aligned with a green warning triangle, is treated as no value at all. Convert those cells to real numbers, for example with the Convert to Number option on the warning, or with Value.

Forgetting the optional order argument. Leaving it out gives the same result as 0 for scores where highest wins. Applying that default to times or penalty counts ranks the worst result first, which is one of the most frequent errors in sports and performance sheets.

Expecting unique ranks. A block of equal scores produces equal ranks and visible gaps in the numbering. That is correct behaviour, not a bug; switch to RANK.AVG or a tie-breaker rule if your sheet needs a clean sequence.

Ranking across the wrong range. Including a totals row, a header row, or people who are excluded from the ranking changes every position. Select only the rows that genuinely compete with each other.

Comparing ranks across groups incorrectly. RANK only works within one list. If you sort or filter by department and rank only the visible rows, the unused rows still influence nothing, but if you want a rank within each group, use COUNTIFS as described in the troubleshooting section rather than a single global range.

Tips

Use RANK.EQ in new workbooks. It is compatible with older files, and it is the function Microsoft continues to support; RANK remains available mainly for backward compatibility.

For a guaranteed unique ranking when ties exist, COUNTIF is often cleaner than RANK: =COUNTIF($B$2:$B$101,">"&B2)+1 gives the descending position, and each duplicate gets the same value. To make duplicates distinct, extend it with a running count, or combine the two approaches so the first duplicate gets the lower number.

For ranks inside categories, use COUNTIFS with two criteria, for example =COUNTIFS($A$2:$A$101,A2,$B$2:$B$101,">"&B2)+1, so each person is ranked only against their own group.

Format the rank column as a plain number with no decimals. RANK.AVG produces fractions like 2.5, which can look odd next to whole-number ranks unless you round them on purpose.

Make the source range an Excel Table (Ctrl+T or Insert > Table) and refer to the column name, so ranks update automatically when you add new rows. Plain ranges do not expand on their own.

Keep a copy of the raw data before sorting. Ranks are static values, so if you sort the table, the rank numbers travel with their rows while the formula may recalculate against a changed layout.

Troubleshooting

The formula returns #N/A. The lookup value is not present in the reference range, or the range is wrong. Confirm that the cell referenced in the first argument is inside the range used in the second. This is usually the dollar-sign problem after copying.

Every rank is 1. The range was left as a single cell rather than the full column. Select the entire score column when building the formula.

Ranks have gaps or duplicates. This is expected for tied scores. Decide whether you want RANK.EQ (highest tied rank, skips), RANK.AVG (average rank, no skips but decimals), or a COUNTIF-based tie-breaker for unique values.

The order looks backwards. Change the third argument from 0 to 1, or the reverse. Remember that times and smaller-is-better measurements need 1.

Some cells return #VALUE!. The score cell contains a formula error or text. Trace the source cell and correct it; RANK cannot rank an error value.

Ranks are wrong after filtering. RANK evaluates hidden rows too. If you need ranks of visible rows only, use SUBTOTAL with the 101 function number to build a counter of visible rows, or use AGGREGATE, rather than plain RANK.

Nothing recalculates. Calculation may be set to manual. Go to Formulas > Calculation Options and confirm it is set to Automatic, or press F9 to force a recalculation.

Frequently Asked Questions

What is the difference between RANK and RANK.EQ?

They return the same result. RANK.EQ is the current version and is the recommended function in new formulas; RANK is kept for compatibility with older spreadsheets.

How do I rank from smallest to largest?

Set the third argument to 1, so =RANK.EQ(B2,$B$2:$B$101,1). Leaving it as 0 or omitting it ranks the largest value as 1.

Why do ties produce the same rank and skip numbers?

RANK and RANK.EQ give tied values the highest position they would occupy and leave the following positions unused, which keeps the ranking honest. Use RANK.AVG or a tie-breaker if you need every position filled.

Can I rank within a group or category?

Yes. Use COUNTIFS with the group as one criterion and the score comparison as the second, so each row is compared only against rows in the same category.

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

Yes, RANK, RANK.EQ and RANK.AVG behave the same across Windows, Mac and the web version, so a formula built on one will calculate correctly on the others.

How do I keep ranks up to date when I add new scores?

Put the data in an Excel Table and reference the table column instead of fixed cell addresses. The range then grows automatically, and the ranks recalculate as new rows are added.