Ranking data in Excel by criteria is essential for organizing large datasets efficiently—whether you’re sorting employees by performance, products by sales, or students by grades. The key tools are direct sorting (for simple ascending/descending orders) and formulas like INDEX-MATCH or SUMPRODUCT, which rank based on complex rules (e.g., “rank by date, then by score”). Here’s how to do it fast, from basic to advanced scenarios.
What You'll Need
- A blank or existing Excel worksheet with your data—columns labeled (e.g., Name, Score, Date).
- Excel’s built-in functions: SORT for basic ranking, INDEX + MATCH for custom conditions, and SUMPRODUCT for weighted rankings.
- Optional: A helper column for intermediate calculations if sorting isn’t enough.
- Knowledge of your sorting priority (e.g., “highest score first” vs. “oldest project first”).
Step-by-Step
- Sort by a single criterion (e.g., scores). Select the data range (e.g., drag from A1 to C100). Go to Home > Sort A to Z (ascending) or Sort Z to A (descending). For custom sort orders (e.g., numeric first, then alphabetic), use: Home > Sort > Custom Sort. Set the primary sort key (e.g., Score) and click OK. This sorts only that column. Note: Labels (e.g., column headers) are sorted too. To exclude them, include only data rows (e.g., rows 2 to 101) in your selection.
-
Rank by criteria in a single column (e.g., rank students by score) using INDEX-MATCH. In a new column (e.g., Column E), enter:
=RANK.EQ(B2, $B$2:$B$100, 0)whereB2is the score cell, and$B$2:$B$100is the range to rank against. The0argument makes it descending; use1for ascending. Drag the formula down. Example: If scores 90, 85, 95 appear, their ranks will be 3, 2, 1. If ties occur: UseRANK.AVG(Excel 365+) instead to assign average ranks to ties. -
Rank with multiple criteria (e.g., rank by date first, then score) using SORT with multiple columns. Select your data range, then:
- Go to Home > Sort A to Z and click Options in the dropdown.
- In the Sort dialog, set the primary sort field (e.g., Column C = Date) and click Add Level.
- Enter the secondary sort (e.g., Column B = Score), then click OK. Excel will now sort by Date ascending, then Score descending.
SORTBY(Excel 365) for dynamic ranking based on hidden formulas. For older Excel, create a helper column with conditional logic (e.g.,=IF(B2>80, "High", "Low")) and sort by that column. -
Rank by weighted criteria (e.g., 50% date, 50% score) using SUMPRODUCT. In a new column, enter:
=SUMPRODUCT(($B$2:$B$100=$B2)*1, ($C$2:$C$100=$C2)*50) + (1-SUMPRODUCT(($B$2:$B$100=$B2)*1))*$D$2where:$B2= target score value (e.g., 90).$C2= target date value (e.g., 1/1/2023).$D2= score weight (e.g., 50 for date, 50 for score).
Common Mistakes
- Sorting headers as data: Labels (e.g., column names) are included in the sort. Exclude them by selecting only rows 2–N in your range or using
SORTBYwith a helper column that excludes headers. - Ranking with empty cells: Excel ignores blank cells in RANK.EQ. Use
IFERRORto assign a default rank (e.g.,=IFERROR(RANK.EQ(B2, $B$2:$B$100, 0), "NA")). - Ignoring data range scope: When using
INDEX-MATCH, the range must include all values to rank. If your data is filtered, apply the formula to the visible range or useOFFSETto account for hidden rows. - Mixing ascending/descending logic: RANK.EQ defaults to descending. Use
RANK.AVG(., 1)for ascending. Confuse these and your ranks will be reversed. - Formula errors in helper columns: Typos (e.g., missing parentheses) break SORTBY or weighted ranking. Test formulas in a separate cell before applying.
Tips
- Use named ranges for complex rankings. Define ranges like
Scores=$B$2:$B$100and reference them in formulas (e.g.,=RANK.EQ(B2, Scores, 0)) for clarity and reusability. - Freeze headers while sorting to keep column labels visible. In the Sort dialog (Step 3 above), check Freeze panes.
- Conditional formatting can highlight top-ranked rows. Apply a gradient fill to the
RANK.EQcolumn (e.g., top 5 scores) using Home > Conditional Formatting > New Rule > Use a formula.... - Sort by text rankings (e.g., “A”, “B”, “Alpha”), but first convert to numbers. Use
=VALUE(LEFT(B2,1))*100 + VALUE(RIGHT(B2,1))*10 + VALUE(MID(B2,2,1))to rank “A1” > “B2” > “C3”. - Backup your data before applying complex formulas. Ranking formulas can’t be undone if errors are introduced.
Troubleshooting
-
Formula returns #N/A. Check for:
- Typo in the lookup value (e.g.,
$B$2vs.$B2). - Data range excludes the lookup cell. Use
OFFSETif rows are filtered:=RANK.EQ(B2, OFFSET($B$2, 0, 0, ROW($B$2)-ROW(B2)+1, COUNTA($B$2:$B$100)), 0). - Empty cells in the lookup range. Filter out blank rows or use
IFERROR.
- Typo in the lookup value (e.g.,
-
Sorting not working. Try:
- Selecting only data cells (skip headers).
- Clicking Sort A to Z in the ribbon, then Options > Custom Sort to debug order.
- Restarting Excel to clear temporary glitches.
-
RANK.EQ gives wrong ranks. Verify:
- The range excludes duplicates (use
UNIQUEfunction for Excel 365). - You’re not using
RANK.EQ(B2, B2:B100, 0), which ranks against itself (result: rank 1).
- The range excludes duplicates (use
-
SUMPRODUCT fails for weighted ranking. Common errors:
- Dividing by zero (e.g., target score = 0). Handle with
IF(B2=0, 0, ...). - Incorrect weight percentages (e.g., 100% for date). Ensure weights sum to 100.
- Dividing by zero (e.g., target score = 0). Handle with
Frequently Asked Questions
How do I rank in Excel by date without sorting?
Use RANK.EQ with a custom date range. Replace $C$2:$C$100 with a range of dates (e.g., dates in Column D). To handle dates like 1/1/2023, ensure they’re in Excel’s date format (DD/MM/YYYY format).
Can I rank by multiple columns in Excel 2019?
Yes, but only with SORT (Step 3 above). For INDEX-MATCH or SUMPRODUCT, create helper columns with logic (e.g., =IF(B2>80, "High", "Low")) and sort by those columns.
Why does RANK.EQ return 0 for all values?
This happens if the lookup value isn’t in the range. Check for typos, hidden blank rows, or mismatched ranges (e.g., $B$2:$B$100 vs. $B$2:$B$5). Use COUNTIF to verify data presence.
How do I rank by percentages (e.g., sales growth)?
Use RANK.EQ directly on the percentage column. For example, if Column E is growth percentages, enter =RANK.EQ(E2, $E$2:$E$100, 0). To handle ties, use RANK.AVG.
What’s the fastest way to rank a large dataset?
For hundreds of rows:
- Use
SORT(1–2 minutes). - For custom ranking, use
INDEX-MATCHwith a named range (reduces errors). - Avoid
SUMPRODUCTfor very large datasets (performance lags).
How can I rank by conditional logic (e.g., “only rank scores > 80”)?
Create a helper column with =IF(B2>80, B2, "NA"), then rank the helper column. Replace "NA" with a value below your cutoff (e.g., -100) to exclude it.