To exclude zero values when calculating an average in Excel, use the AVERAGEIF or AVERAGEIFS function with a condition that ignores cells containing zero. This ensures that only non-zero numbers are included in the average, providing a more accurate representation of your data when zeros are placeholders or irrelevant entries.
What You'll Need
- Microsoft Excel (any recent version: 2010, 2013, 2016, 2019, 2021, or Microsoft 365)
- A dataset containing numbers, some of which may be zero and should be excluded from the average
- Basic familiarity with Excel formulas and cell references
Step-by-Step
- Identify the range of cells you want to average, excluding zeros. For example, if your data is in cells A1 to A10, this is your target range.
- Click on an empty cell where you want the result to appear.
- Type the formula:
=AVERAGEIF(range,"<>0"), replacing "range" with your actual cell range. For A1:A10, the formula becomes=AVERAGEIF(A1:A10,"<>0"). - Press Enter. Excel will calculate the average of all numbers in the range that are not equal to zero.
- If you need to exclude zeros and also ignore other conditions (like text or errors), use
AVERAGEIFSwith multiple criteria. For example, to average only positive non-zero values:=AVERAGEIFS(A1:A10,A1:A10,">0"). - To verify, manually check a few values: sum the non-zero entries and divide by their count. Compare this to the formula result to ensure accuracy.
- If your data range may change, consider using a dynamic named range or Excel Table so the formula adapts automatically when new data is added.
Common Mistakes
- Using
AVERAGEalone, which includes zeros in the calculation and skews the result downward. - Incorrectly writing the criteria as "0" instead of "<>0" — the latter means "not equal to zero," while the former would average only cells that are exactly zero.
- Applying the formula to a range that includes text or errors without handling them, which can cause
#VALUE!or#DIV/0!errors. - Forgetting to update the range when copying the formula to other cells, leading to incorrect references.
- Assuming that blank cells are treated the same as zeros — blanks are automatically ignored by AVERAGEIF, but zeros are not unless explicitly excluded.
Tips
- Use
AVERAGEIFSif you need to exclude zeros and apply additional filters (e.g., only average values from a specific category or date range). - Combine with
IFERRORto handle cases where all values are zero:=IFERROR(AVERAGEIF(A1:A10,"<>0"),0)returns 0 instead of an error when no non-zero values exist. - Format the result cell to show the desired number of decimal places using the Home > Number group.
- If you frequently exclude zeros, consider replacing zeros with blanks or
#N/A(usingNA()) so that standardAVERAGEignores them naturally. - Use Excel’s Evaluate Formula tool (Formulas > Evaluate Formula) to step through how the formula processes each part, helpful for debugging.
Troubleshooting
- Getting a
#DIV/0!error? This means all cells in the range are zero (or non-numeric), so there are no values to average. Check your data or wrap the formula inIFERRORto return a default value. - Result seems too high or too low? Verify that the range is correct and that you haven’t accidentally included header cells or excluded valid data.
- Formula returns an error when copied? Ensure cell references are relative or absolute as needed. Use $ to lock rows or columns (e.g.,
$A$1:$A$10) if copying across. - Zeros are still being included? Double-check the criteria: it must be "<>0" (not equal to zero), not "=0" or "0".
- Working with filtered data? Use
SUBTOTALwith function number 1 or 101 to average visible cells only, but note it doesn’t exclude zeros — combine with helper columns if needed.
Frequently Asked Questions
Can I exclude zeros and blank cells?
Blank cells are automatically ignored by AVERAGEIF and AVERAGEIFS, so no extra step is needed — the formula already excludes both blanks and zeros when using "<>0".
What if I want to exclude zeros and negative numbers?
Use AVERAGEIFS with two criteria: =AVERAGEIFS(range,range,">>0") to average only values greater than zero.
Does this work in Excel for Mac or Excel Online?
Yes, the AVERAGEIF and AVERAGEIFS functions are available and work identically in Excel for Mac, Excel Online, and all modern desktop versions.
Is there a way to do this without a formula?
You could filter the column to hide zeros and then use the SUBTOTAL function on visible cells, but formulas are more reliable and dynamic for recurring use.
Will this method exclude cells that look like zero but are actually text?
Yes, because "<>0" compares numeric values — cells containing text like "0" or "O" are not considered equal to zero and may be included unless they cause errors. Clean data first if text entries are present.
What if I want to include zeros but ignore errors?
Use AVERAGEIF with a criterion that excludes errors: =AVERAGEIF(range,"">=0") works only if errors aren’t present; better to use AGGREGATE function with options to ignore errors.