How to average a range while ignoring zeros (and blanks)
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Get the mean of only the non-zero numbers, so empty or zero cells don't drag the average down.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =AVERAGEIF(A2:A6,"<>0") | Blanks are already ignored by AVERAGE/AVERAGEIF; this also drops zeros. |
| Google Sheets | =AVERAGEIF(A2:A6,"<>0") | Identical. |
| LibreOffice Calc | =AVERAGEIF(A2:A6,"<>0") | Identical. |
How it works
AVERAGEIF(range, "<>0") averages only the cells that are not equal to zero. With 10/0/20/0/30 it averages 10, 20 and 30 = 20. Blank cells are ignored automatically.
Verified, not just documented
We ran =AVERAGEIF(A2:A6,"<>0") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 20 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 20 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run Excel.
Functions used
AVERAGEIF — see full Excel, Google Sheets & LibreOffice compatibility for each.