To add a rank in Excel, use the RANK function (or its modern replacements RANK.EQ and RANK.AVG). The basic formula is =RANK.EQ(B2, $B$2:$B$10), which returns the position of a number within a list, with 1 being the highest. This guide shows you how to rank numbers, handle ties, rank in ascending order, and rank across multiple columns.
What You’ll Need
- Microsoft Excel 365, Excel 2021, Excel 2019, or Excel 2016 (the functions
RANK.EQandRANK.AVGare available in all these versions). - A list of numeric values you want to rank (e.g., sales figures, test scores, times).
- An empty column where the ranks will appear.
Step-by-Step
- Identify your data range. For example, suppose you have sales figures in cells B2:B10, with headers in row 1. You want ranks in column C.
- Select the first cell for the rank. Click on C2.
- Enter the RANK.EQ formula. Type
=RANK.EQ(B2, $B$2:$B$10)and press Enter. The dollar signs ($) lock the range so it doesn’t shift when you copy the formula down. This returns the rank of B2 among all values in B2:B10, with the largest value getting rank 1. - Copy the formula down. Click on the fill handle (the small square at the bottom-right of C2) and drag it down to C10. Each cell now shows the rank of its corresponding value.
- For ascending order (smallest = rank 1), add a third argument:
=RANK.EQ(B2, $B$2:$B$10, 1). The 1 tells Excel to rank in ascending order. - To handle ties differently, use
RANK.AVGinstead. For example,=RANK.AVG(B2, $B$2:$B$10)gives tied values the average rank (e.g., two values tied for 2nd get 2.5).RANK.EQgives both the same rank (both get 2), and the next rank is skipped. - Rank across multiple columns. If your values are in separate columns (e.g., B2:B10 and C2:C10), you can combine them into a single list using
VSTACK(Excel 365) or by referencing both ranges in the array. For example, to rank B2 against both columns, use=RANK.EQ(B2, VSTACK($B$2:$B$10, $C$2:$C$10)). In older versions, you can create a helper column that concatenates the values, but that’s more complex. - Rank with conditions (e.g., rank within groups). Use the
SUMPRODUCTfunction. For example, if column A has group names (A2:A10) and column B has values, to rank B2 within its group, use=SUMPRODUCT(($A$2:$A$10=A2)*($B$2:$B$10>B2))+1. This counts how many values in the same group are greater than B2, then adds 1.
Common Mistakes
- Not using absolute references. If you write
=RANK.EQ(B2, B2:B10)and copy down, the range shifts to B3:B11, B4:B12, etc., giving wrong ranks. Always use$B$2:$B$10. - Ranking text or blank cells. RANK ignores text and blanks, but if your range contains errors or non-numeric values, the formula may return errors. Ensure all values are numbers.
- Confusing RANK.EQ and RANK.AVG. RANK.EQ gives duplicate ranks for ties; RANK.AVG gives fractional ranks. Choose based on your needs.
- Using the old RANK function. While RANK still works, it’s kept for compatibility. RANK.EQ is identical and preferred.
Tips
- Use
RANK.EQfor competition rankings (e.g., 1st, 2nd, 2nd, 4th). UseRANK.AVGfor statistical analysis where ties should be averaged. - To rank in descending order (largest = 1), omit the third argument or use 0. To rank in ascending order (smallest = 1), use 1.
- If you want to see the rank as a percentage (percentile), use
PERCENTRANK.INCorPERCENTRANK.EXC. - For dynamic arrays (Excel 365), you can use
SORTto reorder data by rank, but RANK is simpler for a static rank column. - If your data is in a table (Insert > Table), use structured references like
=RANK.EQ([@Sales], Table1[Sales])to make formulas auto-fill.
Troubleshooting
- #N/A error: This happens if the value you’re ranking is not found in the range. Check that the cell reference and range are correct.
- #VALUE! error: Occurs if the range contains text or non-numeric data. Clean your data or use
IFERRORto handle it. - Ranks appear as decimals unexpectedly: You likely used RANK.AVG or the range includes duplicate values. Switch to RANK.EQ if you want integer ranks.
- Ranks don’t update when data changes: Ensure calculation is set to Automatic (Formulas > Calculation Options > Automatic). If not, press F9 to recalculate.
- On Mac: The functions and steps are identical, but keyboard shortcuts differ (e.g., Cmd+Z for undo). The fill handle works the same.
Frequently Asked Questions
Q: What is the difference between RANK, RANK.EQ, and RANK.AVG?
A: RANK is the legacy function, identical to RANK.EQ. RANK.EQ gives tied values the same rank (e.g., two 2nd places, then 4th). RANK.AVG gives tied values the average (e.g., 2.5 for two tied for 2nd).
Q: How do I rank in reverse order (smallest number gets rank 1)?
A: Use the third argument as 1: =RANK.EQ(B2, $B$2:$B$10, 1).
Q: Can I rank based on multiple criteria?
A: Yes, but it’s more complex. You can use SUMPRODUCT with multiple conditions, or create a helper column that combines criteria (e.g., =B2&”-“&C2) and rank that. For Excel 365, you can use SORTBY and SEQUENCE.
Q: Why does my rank formula return #N/A?
A: The value you’re ranking must exist in the range. If it’s a text number or a formula result that isn’t numeric, it won’t match. Ensure all values are numbers.
Q: How do I rank only visible (filtered) cells?
A: RANK doesn’t ignore hidden rows. You can use SUBTOTAL with a helper column, or use AGGREGATE. For example, =SUMPRODUCT(SUBTOTAL(3,OFFSET($B$2:$B$10,ROW($B$2:$B$10)-MIN(ROW($B$2:$B$10)),0,1)),--($B$2:$B$10>B2))+1 is complex; simpler to copy data to a new sheet and rank there.
Q: Can I rank across multiple worksheets?
A: Yes, by referencing ranges from different sheets, e.g., =RANK.EQ(B2, (Sheet1!$B$2:$B$10, Sheet2!$B$2:$B$10)) in Excel 365 using VSTACK, or in older versions you can use a named range that includes both sheets (e.g., define a name that references both).
Related
- 911 Data Entry Practice Test: 10 Realistic Drills
- NP Generate Random Numbers? What It Means
- How to Add a Hide Button in Excel
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Embed Video in PowerPoint: Is the Feature Discontinued?No—embedding video in PowerPoint has not been discontinued. In PowerPoint for Microsoft 365 on Windows, you can still…
- How to Double Space in Word Without the Design TabTo double-space text in Microsoft Word, select the text, open Home > Line and Paragraph Spacing, and choose…
- VLOOKUP with Two Lookup Values in Google Sheets ExplainedYes. To use VLOOKUP with two lookup values in Google Sheets, combine the values into one key on…
- Freelance Videographer Invoice Template ExcelYes, you can create a professional freelance videographer invoice in Excel using a simple layout with columns for…
- How to Import Archive Emails in Outlook: Full GuideTo import archived emails into Outlook for Windows, open classic Outlook and choose File > Open & Export…
- Excel Mac Data Analysis: Tools, Steps, and LimitsYes—Excel for Mac can analyze data with formulas, PivotTables, charts, and, in supported desktop versions, the Analysis ToolPak…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.