How to Not Rank Zeros in Excel: 4 Fixes

How-to basics · Updated November 23, 2026

To stop Excel from ranking zero values, wrap your ranking formula in an IF statement that returns a blank or a custom label when the value is 0, or use the RANK function with a helper column. For example, with values in B2:B10, use =IF(B2=0,"",RANK(B2,$B$2:$B$10,0)) in C2 and copy down—this leaves the rank cell empty for any zero, while still ranking all other numbers normally. Below are the full methods, including how to handle ties, negative numbers, and cases where you want zeros to appear at the bottom instead of being skipped.

Why Excel Ranks Zeros and Why It Matters

Excel’s RANK, RANK.EQ, and RANK.AVG functions treat 0 as a valid numeric value, so they include it in the ranking order. If your dataset contains blanks, text, or zero values, the function ranks zeros just like any other number—often giving them the lowest rank (largest number) if you sort descending, or the highest rank if you sort ascending. This is a problem when you’re ranking sales, scores, or test results where a zero means “no data” or “not attempted,” not a genuine performance level. Leaving zeros in the rank column can mislead readers, skew averages, or make conditional formatting highlight the wrong cells.

Method 1: IF + RANK to Exclude Zeros

The simplest fix is to check for zero before ranking. Assume your numbers are in A2:A10, and you want ranks in B2:B10. In B2, enter:

=IF(A2=0,"",RANK(A2,$A$2:$A$10,0))

Copy this down to B10. The result: any cell with 0 shows an empty string (looks blank), and all non-zero values get a rank from 1 (highest) to the count of non-zero entries. For example, if A2:A10 contains {10, 8, 0, 7, 0, 9, 6, 0, 5}, the ranks in B2:B10 will be {1, 3, “”, 4, “”, 2, 5, “”, 6}. The zeros are simply not ranked. If you prefer to show a text label like “No Data” instead of a blank, replace the empty quotes with "No Data".

Method 2: Using RANK.AVG or RANK.EQ with a Helper Column

If you need to preserve the original dataset and want a cleaner formula, add a helper column that converts zeros to a very large number (so they rank last) or to a blank that RANK ignores. However, RANK does not ignore blanks—it treats them as 0. So the better helper approach is to replace zeros with a number that will never win a rank, then hide that helper column. In a new column C, put:

=IF(A2=0,10^10,A2)

Then in D2, rank the helper column:

=RANK(C2,$C$2:$C$10,0)

Now zeros get a rank of 10 (or the largest rank), effectively placing them at the bottom. If you want them to appear as blanks, wrap this in an IF as well: =IF(A2=0,"",RANK(C2,$C$2:$C$10,0)). This method is useful when you need to sort by rank later, because the helper column keeps the zeros in a predictable position.

Method 3: Ignore Zeros with AGGREGATE or FILTER (for Dynamic Arrays)

If you’re using Excel 365 or Excel 2021, the FILTER function can create a dynamic list of non-zero values, and then you can rank within that filtered array. For instance, with data in A2:A10, put this formula in C2:

=IFERROR(RANK(A2,FILTER($A$2:$A$10,$A$2:$A$10<>0),0),"")

This ranks each value against only the non-zero entries. The IFERROR catches the case where A2 is 0, because 0 isn’t in the filtered array, so RANK returns an error—which you convert to a blank. Alternatively, use AGGREGATE with option 15 (RANK) to ignore errors, but that’s more complex. The FILTER method is the most modern and automatically updates if you add or remove data.

How to Choose the Right Method

Your choice depends on your Excel version and what you want the zeros to look like:

  • Blank rank cell – Use Method 1 (IF+RANK) for any version, or Method 3 for Excel 365/2021.
  • Zeros ranked last but visible – Use Method 2 with a helper column and a large replacement number.
  • Zeros completely excluded from the rank scale – Method 1 or 3, because they only rank non-zero values.
  • Need to handle ties with average ranks – Replace RANK with RANK.AVG in any method; the syntax is identical.

For example, if you’re ranking student test scores where 0 means “absent,” you likely want a blank, so Method 1 is best. If you’re ranking sales where 0 is a legitimate low value, you might want to show it at the bottom, so Method 2 works.

Common Problems and Pitfalls

One frequent mistake is using RANK on a range that includes text or blank cells—Excel treats blanks as 0, so they get ranked. Always ensure your data range contains only numbers or use the IF check to exclude blanks too, like =IF(OR(A2=0,A2=""),"",RANK(A2,$A$2:$A$10,0)). Another issue is the order argument: 0 means descending (largest gets rank 1), while 1 means ascending (smallest gets rank 1). If you use the wrong order, zeros will appear at the top when you expect them at the bottom. Also, when copying formulas, remember to lock the range with absolute references ($A$2:$A$10) so it doesn’t shift. Finally, if you have duplicate non-zero values, RANK gives them the same rank and skips the next—for example, two 10s both get rank 1, and the next value gets rank 3. If you want consecutive ranks, use RANK.AVG or a tie-breaking formula like =RANK(A2,$A$2:$A$10,0)+COUNTIF($A$2:A2,A2)-1.

Comparing RANK, RANK.EQ, and RANK.AVG

All three functions work the same way for excluding zeros when wrapped in IF. The difference is only in tie handling: RANK and RANK.EQ give duplicate values the same rank and skip subsequent ranks; RANK.AVG gives duplicates the average of the ranks they would have received. For example, with values {10, 10, 8} descending, RANK gives 1, 1, 3, while RANK.AVG gives 1.5, 1.5, 3. If you’re ranking scores and want to avoid gaps, use RANK.AVG. For sports standings where ties are allowed, RANK.EQ is standard. The method to exclude zeros is identical for all three—just replace the function name.

Alternatives: Conditional Formatting and Pivot Tables

If you don’t need a rank column at all, you can use conditional formatting to visually hide zeros. Select your data range, go to Home > Conditional Formatting > New Rule, choose “Use a formula to determine which cells to format,” enter =A2=0, and set the font color to white or the fill to match the background. This hides zeros without changing the underlying data. For a more robust solution, create a pivot table and use the “Value Field Settings” to show ranks as a calculated field—but pivot tables don’t natively exclude zeros from ranking; you’d need to filter them out first. Another alternative is to use the LARGE or SMALL functions to list top N values, which naturally skip zeros if you use an array formula like =LARGE(IF(A2:A10<>0,A2:A10),1) (enter with Ctrl+Shift+Enter in older Excel).

Frequently Asked Questions

How do I rank only positive numbers in Excel?
Use the same IF approach but check for A2>0 instead of A2=0. For example, =IF(A2>0,RANK(A2,$A$2:$A$10,0),"") will rank only positive values and leave negatives and zeros blank.

Why does my RANK formula return an error for zero?
If you use the FILTER method, a zero isn’t in the filtered array, so RANK returns a #N/A error. That’s why you wrap it in IFERROR to convert it to a blank. In the basic IF+RANK method, zeros don’t cause errors—they just get ranked normally.

Can I make zeros rank last but still show a number?
Yes. Use Method 2 with a helper column that replaces 0 with a very large number like 10^10. Then the rank for zeros will be the largest number in the range, effectively placing them at the bottom. To display that rank, just don’t wrap it in IF.

Does this work in Google Sheets?
Yes, the same functions and syntax work in Google Sheets. The only difference is that in Google Sheets, you might use ARRAYFORMULA to apply the formula to a range at once, but the basic IF+RANK formula works identically.

How do I rank a column that has blank cells, not zeros?
Blanks are treated as 0 by RANK, so you need to exclude them too. Use =IF(A2="","",RANK(A2,$A$2:$A$10,0)) to leave blanks empty. If you have both blanks and zeros, combine conditions: =IF(OR(A2="",A2=0),"",RANK(A2,$A$2:$A$10,0)).

What if I want to rank from smallest to largest but exclude zeros?
Change the third argument in RANK from 0 to 1. For example, =IF(A2=0,"",RANK(A2,$A$2:$A$10,1)) will give the smallest non-zero value a rank of 1, and zeros remain blank.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.