Average in Excel: Excluding Zeros with Simple Formulas

Learn how to compute averages in Excel while excluding zeros using AVERAGEIF, AVERAGEIFS, and array formulas. Includes practical examples, edge cases, and best practices for clean data analysis.

XLS Library
XLS Library Team
·5 min read
Quick AnswerDefinition

To compute the average while excluding zeros in Excel, use AVERAGEIF on your data range with the condition "<>0". For example, =AVERAGEIF(B2:B100, "<>0"). This ignores zeros (and blanks) so your mean reflects nonzero observations. If you need more control, you can combine with AVERAGEIFS or array formulas.

Why zeros distort averages and when to exclude them

According to XLS Library, zeros in datasets can distort the true central tendency, especially when zeros are placeholders or signal missing data rather than actual measurements. The XLS Library team found that excluding zeros from calculations often reveals a clearer picture of typical values, which is crucial in budgeting, quality control, and survey analysis. In Excel, ignoring zeros is straightforward with built-in functions. This section explains the rationale and shows a concrete starting point you can reuse in your worksheets.

Excel Formula
=AVERAGEIF(B2:B100, "<>0")

What this does: It averages only the numbers in B2:B100 that are not equal to zero. Blanks are ignored because they don’t meet the criteria. If your data include non-numeric values, wrap with IFERROR to handle errors gracefully.

Pro tip: For more complex conditions, AVERAGEIFS offers additional flexibility, but for a single nonzero filter, AVERAGEIF is typically enough.

Quick-start: average excluding zeros with AVERAGEIF

The simplest approach is the standard AVERAGEIF pattern. Use the test range to filter out zeros and, if needed, specify a separate range to average. Examples you can adapt in your workbook:

Excel Formula
=AVERAGEIF(Sales!C2:C500, "<>0")
Excel Formula
=AVERAGEIF(Sales!C2:C500, "<>0", Sales!D2:D500)

Explanation:

  • The first formula tests C2:C500 and averages the matching cells within the same range.
  • The second uses a different average_range (D2:D500), which is useful when the values to average live in another column but you still want to exclude zeros from the test range.

If you’re aggregating across a large dataset, consider defining a named range for readability and maintainability.

Alternatives: AVERAGEIFS and array formulas

When you need more than one criterion, AVERAGEIFS can help. For a nonzero test across the same data, you can use:

Excel Formula
=AVERAGEIFS(A2:A100, A2:A100, "<>0")

If you prefer an array-based approach (useful in older Excel versions or when combining multiple logical tests), you can enter this as an array formula:

Excel Formula
{=AVERAGE(IF(A2:A100<>0, A2:A100))}

Note: In modern Excel, dynamic arrays may render the explicit array-entered form unnecessary, but it remains a valid option for compatibility.

Handling blanks and non-numeric data

Zeros aren’t the only caveat when averaging. Blank cells and non-numeric entries should also be addressed to avoid errors or misleading results. The methods below ensure a robust calculation:

Excel Formula
=IFERROR(AVERAGEIF(A2:A100, "<>0"), "N/A")
Excel Formula
{=AVERAGE(IF(ISNUMBER(A2:A100), IF(A2:A100<>0, A2:A100)))}

What these do:

  • The IFERROR version returns a friendly result when there are no matching values (instead of an error).
  • The ISNUMBER-based array formula filters out non-numeric data before applying the nonzero test. Enter with Ctrl+Shift+Enter in legacy Excel versions.

XLS Library analysis shows that combining these strategies improves reliability in mixed data environments.

Practical considerations for large datasets and real-world data

As datasets grow, the performance of array-based approaches can degrade. In practice, preferring AVERAGEIF or AVERAGEIFS with well-scoped ranges tends to be faster and simpler to audit. If your data span multiple sheets or you need dynamic ranges, consider named ranges or a small helper column that marks nonzero numeric values, then average only those markers. This keeps formulas readable and reduces recalculation overhead.

Excel Formula
=AVERAGEIF(DataRange, "<>0")

For eye-checks, always test with representative samples: include zeros, blanks, text, and error values to ensure your final formula behaves as intended.

Real-world example: sales dataset

Suppose column C in the Sales sheet contains daily sales figures, with zeros representing days with no sales and blanks for missing data. To get the average excluding zeros:

Excel Formula
=AVERAGEIF(Sales!C2:C100, "<>0")

If you want to cross-check against a separate column of recorded amounts, you can use the optional average_range parameter:

Excel Formula
=AVERAGEIF(Sales!C2:C100, "<>0", Sales!D2:D100)

In this snippet, the nonzero values in C2:C100 are tested, while the corresponding figures in D2:D100 are averaged. The practical takeaway is that excluding zeros yields a truer measure of typical performance; the technique scales to hundreds of thousands of rows when ranges are defined efficiently. The XLS Library team would recommend documenting the chosen approach and validating results with a small, labeled sample before deploying in dashboards.

Summary of what to remember

  • Use AVERAGEIF(range, "<>0") to exclude zeros from the average.
  • If you need multiple criteria, switch to AVERAGEIFS or an array-based solution for compatibility.
  • Wrap with IFERROR for clean results when no matches exist.
  • For large datasets, prefer pre-defined named ranges over volatile, multi-range formulas.
  • Always test on representative data to confirm behavior with blanks and non-numeric entries.

Steps

Estimated time: 30-45 minutes

  1. 1

    Identify your data range

    Select the numeric column or range you plan to average. Confirm there are no non-numeric values that would disrupt the calculation. If helpful, name the range for readability.

    Tip: Use a named range like DataSales to simplify formulas.
  2. 2

    Choose the nonzero filter

    Decide whether a single nonzero test suffices or if additional criteria are needed. For a single criterion, AVERAGEIF is typically enough.

    Tip: Prefer AVERAGEIF over AVERAGE with IF for clarity.
  3. 3

    Enter the formula

    Type =AVERAGEIF(range, "<>0") or the alternates when needed. If you’re testing with a separate range, include the optional average_range argument.

    Tip: Start with a simple formula, then expand to multiple criteria.
  4. 4

    Apply and verify results

    Copy or fill the formula to adjacent cells as needed and compare results against a manual calculation for a subset.

    Tip: Check a few rows where zeros are present to ensure they’re excluded.
  5. 5

    Handle non-numeric data safely

    Wrap the formula with IFERROR or use an ISNUMBER guard in an array formula to prevent errors.

    Tip: IFERROR keeps your dashboards clean when data is incomplete.
  6. 6

    Document and maintain

    Add a short note in the workbook describing why zeros are excluded and which formula is used.

    Tip: Maintaining a data dictionary helps future you.
Pro Tip: Prefer AVERAGEIF over a general AVERAGE with IF for readability and efficiency.
Warning: If all values are zero, AVERAGEIF returns #DIV/0!; handle with IFERROR.
Note: Blanks are not considered numeric and will be ignored by AVERAGEIF with the "<>0" criterion.

Prerequisites

Required

Optional

  • A sample data range in Excel to practice
    Optional
  • Optional: concepts of array formulas (Ctrl+Shift+Enter in legacy Excel)
    Optional

Keyboard Shortcuts

ActionShortcut
CopyCopy selected cellsCtrl+C
PastePaste into destinationCtrl+V
Fill DownFill formula/value from aboveCtrl+D
UndoUndo last actionCtrl+Z
RedoRedo last undone actionCtrl+Y
FindSearch within worksheetCtrl+F
ReplaceReplace text or valuesCtrl+H

People Also Ask

What happens if all values are zero when using AVERAGEIF(range, "<>0")?

If every value in the range is zero (or non-numeric), AVERAGEIF has no matching values and returns #DIV/0!. Use IFERROR to present a friendlier message.

If all values are zero, the formula would error, so wrap it with IFERROR to show a friendly result.

Does AVERAGEIF ignore blanks as zeros when computing the average?

Yes. Blanks are not numeric and will be ignored with the test "<>0". They do not affect the average of nonzero values.

Blanks don’t get included in the average when you filter with nonzero values.

When should I use AVERAGEIFS instead of AVERAGEIF?

Use AVERAGEIFS when you need multiple criteria (for example, nonzero values in one column and a date range in another). It allows several conditions in one function.

If you have several conditions to meet, go with AVERAGEIFS.

Can I apply this across multiple sheets or a whole workbook?

Formulas target a specific range on a sheet. To apply across sheets, you must reference each sheet’s range or consolidate data first. Consider a 3D reference pattern with caution.

You generally apply the formula within a single sheet; cross-sheet use is more involved.

What about non-numeric data in the range besides zeros and blanks?

Non-numeric data is ignored by AVERAGEIF when using the "<>0" test, but for stricter data integrity you can wrap your calculation with ISNUMBER checks or use IFERROR.

Non-numeric values are ignored by the nonzero test, but you can guard with ISNUMBER if needed.

The Essentials

  • Exclude zeros with AVERAGEIF(range, "<>0")
  • Use AVERAGEIFS for multiple criteria when needed
  • Guard against errors with IFERROR around the average
  • Test formulas on representative data before deployment
  • Document formulas for maintainability

Related Articles