Smart Systems for Home

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

How to Average in Excel Ignoring Zeros

· 6 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 average in Excel while ignoring zeros, use the AVERAGEIF function with a criteria of "<>0". For example, =AVERAGEIF(A1:A10,"<>0") returns the average of all numbers in A1:A10 except cells containing zero. This works because AVERAGEIF only considers cells that meet the specified condition, and the condition "<>0" means "not equal to zero." You can also use AVERAGEIFS for multiple conditions, or array formulas with IF and AVERAGE for more complex scenarios. This guide covers the simplest method first, then alternatives and troubleshooting.

What You'll Need

  • Microsoft Excel (any recent version; steps apply to Excel for Microsoft 365, Excel 2021, 2019, and earlier; slight differences for Mac and Excel for the web are noted).
  • A range of numeric cells that may contain zeros or blank cells.
  • Basic familiarity with entering formulas in a cell.

Step-by-Step

  1. Identify the range that contains the numbers you want to average. For example, suppose your numbers are in cells A2 through A10.
  2. Select a cell where you want the result to appear. This could be B2, C1, or any empty cell.
  3. Type the formula =AVERAGEIF(A2:A10,"<>0") and press Enter. Excel will calculate the average of all numbers in A2:A10 that are not equal to zero. If your range contains text or blanks, they are ignored automatically by AVERAGEIF.
  4. Verify the result by manually checking a few numbers. For instance, if A2:A10 contains 5, 0, 10, 0, 15, 20, 0, 25, 30, the formula returns 17.5 (sum of 5+10+15+20+25+30 = 105, divided by 6 non-zero numbers).
  5. For multiple criteria, use AVERAGEIFS. For example, to average values in B2:B10 where A2:A10 is "Product A" and B2:B10 is not zero, use =AVERAGEIFS(B2:B10,A2:A10,"Product A",B2:B10,"<>0").
  6. If you need to ignore zeros but include negative numbers, the same formula works because it only excludes cells equal to zero.
  7. For Excel for Mac, the formula and steps are identical; the function names and syntax are the same.
  8. For Excel for the web, the same formula works. Just type it into a cell in the browser.
  9. If you prefer an array formula (for older Excel versions that lack AVERAGEIF, though most have it), you can use =AVERAGE(IF(A2:A10<>0,A2:A10)) and press Ctrl+Shift+Enter (on Mac: Cmd+Shift+Enter) to enter it as an array formula. In Excel 365, you can press Enter normally because dynamic arrays are supported.
  10. To ignore zeros and blanks (though blanks are already ignored), the same AVERAGEIF formula handles both.

Common Mistakes

  • Using AVERAGE directly on a range that includes zeros. This includes zeros in the divisor, lowering the average. Always use AVERAGEIF or filter first.
  • Writing the criteria incorrectly: "<>0" is correct. Do not use "!=0" or "not 0" – Excel uses <> for not equal.
  • Forgetting quotes around the criteria. In AVERAGEIF, the criteria must be a string, so "<>0" is required. If you type <>0 without quotes, Excel will treat it as a comparison and may error.
  • Using AVERAGEIF with a range of different sizes for average_range and criteria_range. If you use the optional average_range, both ranges must be the same size; otherwise, results may be wrong or #VALUE! error.
  • Assuming blanks are treated as zeros. They are not; AVERAGEIF ignores blank cells automatically, so you don't need to explicitly exclude them.

Tips

  • Use a cell reference for criteria if you want to change the condition easily. For example, put "<>0" in a cell (say D1) and use =AVERAGEIF(A2:A10,D1).
  • Combine with other functions like IFERROR to handle cases where no numbers meet the criteria. For example, =IFERROR(AVERAGEIF(A2:A10,"<>0"),"No data") displays a message instead of #DIV/0!.
  • Use a dynamic array formula in Excel 365: =AVERAGE(FILTER(A2:A10,A2:A10<>0)) which filters out zeros and averages the rest. This is more flexible if you need to apply additional filters.
  • To ignore zeros in a pivot table, you can add a calculated field or use a slicer to filter out zero values, but the simplest is to use AVERAGEIF in a regular formula.
  • Remember that AVERAGEIF ignores text and logical values in the range, so you don't need to clean the data for those.

Troubleshooting

  • Formula returns #DIV/0! – This means no cells meet the criteria (all are zero or blank). Check that there is at least one non-zero number. If you want to avoid the error, wrap with IFERROR as shown in Tips.
  • Formula returns #VALUE! – Usually because the criteria is not a string or the ranges are mismatched. Ensure the criteria is in quotes and that average_range (if used) is the same size as criteria_range.
  • Result seems too low – Double-check that you are not accidentally including zeros. For example, if you used =AVERAGE(A2:A10) instead of AVERAGEIF, zeros are included. Also verify that the range is correct.
  • Result is different from manual calculation – Recheck the range and criteria. Also note that AVERAGEIF ignores blank cells, but if you have cells with spaces or non-numeric text, they are ignored as well. If you have numbers stored as text, they may be excluded; use the VALUE function or text-to-columns to convert them.
  • Excel for the web doesn't recognize the formula – Ensure you are using the English function names. In some localized versions, the function might be different (e.g., MOYENNE.SI in French). Check your language settings.
  • Array formula not working – If you used the IF array method and pressed Enter without Ctrl+Shift+Enter in older Excel, it may return a single value incorrectly. In Excel 365, dynamic arrays handle it automatically, but in older versions, you must confirm with Ctrl+Shift+Enter.

Frequently Asked Questions

  • Can I ignore zeros and also exclude negative numbers? Yes, use AVERAGEIFS with two criteria: =AVERAGEIFS(A2:A10,A2:A10,"<>0",A2:A10,">0") to average only positive non-zero numbers.
  • Does AVERAGEIF ignore blank cells automatically? Yes, blank cells are ignored. Only cells that meet the criteria are included; blanks do not match "<>0" because they are not equal to zero, but they are not counted as numbers, so they are excluded from both numerator and denominator.
  • What if I want to ignore zeros but include cells with text? Text cells are already ignored by AVERAGEIF. If you want to include text as zero, you'd need a different approach, but typically you don't.
  • How do I ignore zeros in a filtered list? AVERAGEIF works on the entire range, not just visible cells. To average only visible cells that are non-zero, use the SUBTOTAL function with function_num 101 (AVERAGE) combined with a filter that hides zero rows, or use a helper column with a formula like =IF(A2<>0,A2,"") and then average that helper column.
  • Is there a way to ignore zeros without using a formula? You can use the AVERAGE function on a range that has zeros filtered out, but that requires manual filtering. The formula approach is more dynamic and efficient.
  • Can I use AVERAGEIF to ignore zeros in multiple columns at once? AVERAGEIF works on a single range. To average multiple columns while ignoring zeros, you'd need to combine them into one range (e.g., =AVERAGEIF(A2:C10,"<>0") works if all cells are numeric, but it averages all non-zero cells across the range). If you need separate averages per column, use separate formulas.