How to Calculate averages while ignoring error values in Excel

Learn multiple Excel methods to calculate averages while ignoring error values with step-by-step examples and practical applications.

excelformulaspreadsheettutorial
12 min read • Last updated: 7/2/2025

How to Calculate averages while ignoring error values in Excel

Why This Task Matters in Excel

Every analyst eventually inherits or builds a workbook that combines numeric results with occasional errors such as #DIV/0!, #N/A, or #VALUE!. These error values often represent legitimate business realities—missing data, divide-by-zero situations, or lookup failures—but they also break summary statistics. When a single error sits inside a range, a classic =AVERAGE() returns an error instead of an average. The result is lost insight:

  • A regional sales dashboard cannot show an average sales price because one branch has yet to report figures (cells return #N/A).
  • A project-management sheet producing #DIV/0! for tasks with zero duration prevents the team from monitoring overall schedule performance.
  • A lab quality-control file containing #VALUE! where non-numeric comments were typed stops an engineer from calculating mean temperatures.

Across finance, operations, healthcare, education, and research, leaders rely on “average” as a core metric—average unit cost, average length of stay, average defect rate, average customer rating. Excel remains the de-facto tool for these calculations because of its flexibility, ad-hoc responsiveness, and rich library of statistical functions. Yet without a method to ignore errors, entire dashboards can fail, automated emails show glaring #DIV/0!, and stakeholders lose confidence in the analysis.

Mastering techniques that combine averaging with error handling has cascading benefits:

  • Ensures KPIs, charts, and conditional formatting rules stay intact even when data feeds are imperfect.
  • Avoids manual data cleansing and the temptation to delete rows containing errors, preserving traceability.
  • Integrates seamlessly with existing workflows—Power Query, PivotTables, dynamic arrays, and VBA all respect clean numeric outputs.
  • Enhances robustness of templates shared across departments or uploaded to collaboration platforms such as SharePoint or Teams.

Focusing on this skill also deepens broader Excel proficiency. You will leverage logical functions (IF, ISNUMBER, IFERROR), array calculations, dynamic functions (FILTER, AGGREGATE), and understand how Excel treats different data types. These concepts recur in many other tasks, from forecasting to conditional statistics. Failing to learn them can lead to hidden inaccuracies, hours spent troubleshooting broken reports, and missed opportunities to automate repetitive checks.

Best Excel Approach

The most reliable, portable, and future-proof method for calculating an average while ignoring error values is Excel’s AGGREGATE function. AGGREGATE is specifically designed to perform aggregate operations—sum, average, count, median, percentiles—while optionally skipping hidden rows, nested subtotals, and, importantly, error values.

Syntax used for this task:

=AGGREGATE(function_num, options, array, [k])

For our purpose:

  • function_num 1 represents AVERAGE.
  • options 6 tells Excel “ignore error values”.
  • array is the numeric range you want to average.
  • [k] is not needed for averaging (reserved for functions such as LARGE or SMALL).

Putting it together:

=AGGREGATE(1, 6, A2:A15)

Why this approach stands out:

  1. Simplicity – A single non-array formula returns the correct result without requiring special keystrokes or helper columns.
  2. PerformanceAGGREGATE is optimized inside Excel’s calculation engine and recalculates much faster than equivalent nested array formulas, especially across thousands of rows.
  3. CompatibilityAGGREGATE is available in Excel 2010 and later on Windows and in Excel 2011 and later on Mac, covering the vast majority of modern environments.
  4. Transparency – Anyone reading the workbook sees an explicit instruction to ignore errors, rather than a complex nested IF(ISNUMBER(...)) expression that hides intent.

When to consider alternatives:

  • You are distributing a workbook to colleagues running Excel 2007 or earlier—AGGREGATE did not exist then.
  • You are already heavily using dynamic array functions available in Microsoft 365, and a FILTER approach fits naturally.
  • You need additional filtering logic based on criteria (for example, average only positive numbers and ignore errors). In that case, AVERAGE(IF()) or AVERAGEIFS() with dynamic arrays may be more flexible.

Parameters and Inputs

Before building formulas, confirm the following for your data range:

  • Numeric Entries – Only numeric values should contribute to the average. Text entries will be ignored automatically by Excel’s average functions, but error values must be explicitly skipped.
  • Error Types – Common Excel errors include #DIV/0!, #N/A, #VALUE!, #NUM!, #REF!, and #NAME?. AGGREGATE option 6 ignores them all.
  • Range SizeAGGREGATE handles both contiguous ranges (e.g., [A2:A15]) and multiple-area ranges if you wrap them inside an array constant or use helper formulas.
  • Dynamic Arrays – In Microsoft 365, ranges can spill. If you refer to the top cell of a spill range (e.g., B2#), AGGREGATE treats the entire spilled array as its input.
  • Hidden Rows or Filtered Data – If you also want to ignore hidden rows, add option 7 instead of 6. Option 7 skips both hidden rows and errors.
  • Data Validation – Where possible, restrict input cells to numeric entries using Data Validation rules to minimize unexpected errors.
  • Edge Cases – A range containing only errors will result in #DIV/0! because no numeric values remain. Test for this with an IFERROR() wrapper if necessary.

Step-by-Step Examples

Example 1: Basic Scenario

Imagine a small dataset tracking weekly website visits. Due to a division formula in column B, some rows return #DIV/0! when page view counts are zero:

A (Week)B (Visits per Session)
Week 13.25
Week 22.87
Week 3#DIV/0!
Week 44.12
Week 5#DIV/0!
Week 63.55

Goal: Calculate the average visits per session across all weeks, ignoring the error cells.

Step-by-step:

  1. Select your results cell—for example, C2.

  2. Enter the formula:

    =AGGREGATE(1, 6, B2:B7)
    
  3. Press Enter. Excel returns 3.45 (the average of 3.25, 2.87, 4.12, 3.55).

  4. Explain the logic:

    • function_num 1 tells Excel to calculate an average.
    • options 6 guarantees any error within B2:B7 is excluded from the calculation.
  5. Verify by manually adding the four non-error numbers and dividing by four: (3.25 + 2.87 + 4.12 + 3.55) / 4 = 13.79 / 4 = 3.4475 (rounded to 3.45).

  6. Common variations: If you expect potential negative numbers and only want positive values, extend the formula with IF plus dynamic arrays:

    =AVERAGE(FILTER(B2:B7, (B2:B7>0)*(ISNUMBER(B2:B7))))
    

Troubleshooting:

  • Formula returns #DIV/0! – All cells in the range are errors or non-numeric. Wrap with IFERROR:

    =IFERROR(AGGREGATE(1,6,B2:B7), "No data")
    
  • Wrong average – Check if hidden rows contain numbers. Option 6 ignores errors but counts hidden values; use option 7 to skip them.

Example 2: Real-World Application

Scenario: A manufacturing company logs hourly production counts from multiple lines. An external data feed sometimes reports #N/A when sensors lose connection. Management wants a daily report summarizing the average units produced per hour.

Data structure (simplified):

ABCDE
HourLine 1Line 2Line 3Line 4
08:00120128#N/A119
09:00#N/A130121118
10:00123#N/A124117
...............

Goal: Compute the overall average across all operational lines for each hour and then an end-of-day average across all hours.

Steps:

  1. Per-hour average (row 3)
    Place this formula in cell F3 and copy downward:

    =AGGREGATE(1,6,B3:E3)
    

    Result: Hour 08:00 shows 122.33 (average of 120,128,119), Hour 09:00 shows 123 (average of 130,121,118).

  2. End-of-day average
    In cell F26 (assuming data runs to row 25):

    =AGGREGATE(1,6,F3:F25)
    

    This two-layer aggregation ensures any #N/A from sensors is ignored in both per-hour and daily calculations.

Integration with other Excel features:

  • Conditional Formatting – Highlight rows where the AGGREGATE result is below a production target.
  • PivotTables – Use the clean numeric data in column F as a source field. PivotTables skip error checks and remain efficient.
  • Power Query – If importing sensor logs through Power Query, consider cleaning errors upstream; yet AGGREGATE provides an extra safeguard.

Performance considerations:

  • Daily logs may include tens of thousands of rows (multiple days). AGGREGATE recalculates significantly faster than array formulas repeating IF(ISNUMBER(...)), reducing workbook bloat and volatile recalculations.

Example 3: Advanced Technique

Suppose you maintain a portfolio tracker across multiple sheets—one per month. Each sheet has daily percentage returns in column C, some of which show #VALUE! when holidays cause missing data. You want a year-to-date (YTD) average return that updates automatically as new sheets are added.

Approach:

  1. Create a 3-D reference name
    Define a named range called AllMonths referring to:

    =January:December!C2:C32
    

    (Assumes each monthly sheet is named January, February, … December).

  2. Use AGGREGATE with a 3-D reference
    In the YTD summary sheet, cell B4:

    =AGGREGATE(1,6,AllMonths)
    

    AGGREGATE traverses all sheets in the reference, ignoring any #VALUE! along the way.

  3. Edge case handling
    If some months have not yet been created, Excel returns a #REF! error. Wrap the formula in IFERROR:

    =IFERROR(AGGREGATE(1,6,AllMonths), "Months missing")
    
  4. Performance optimization
    Calculating across 12 sheets with thousands of entries can be heavy. Store intermediate monthly averages in each sheet (cell Z2, for example) using AGGREGATE, then compute the YTD average across those 12 cells. This reduces data traversed from tens of thousands of cells to 12.

  5. Professional tips

    • Use the LET function (Microsoft 365) to name intermediate results inside a single formula.
    • Document the 3-D reference in workbook documentation so collaborators understand where the data originates.
    • Protect sheets to prevent accidental deletion of column C or insertion of rows above row 2 which would shift the reference.

Tips and Best Practices

  1. Choose the right option code – Option 6 ignores errors; option 7 ignores both hidden rows and errors, ideal for filtered lists.
  2. Wrap with IFERROR for user-friendly output – Replace top-level errors with messages like “No valid numbers”.
  3. Use named ranges – Improves readability (=AGGREGATE(1,6,Sales_Amounts)), especially in large models.
  4. Combine with dynamic arrays – In Microsoft 365, nest FILTER before AGGREGATE to apply extra criteria without helper columns.
  5. Minimize volatile dependencies – Avoid wrapping AGGREGATE in volatile functions like OFFSET or INDIRECT to keep workbook performance high.
  6. Document assumptions – Add cell comments or a documentation sheet explaining why errors are ignored; auditors appreciate transparency.

Common Mistakes to Avoid

  1. Using AVERAGEIF expecting it to skip errors automaticallyAVERAGEIF stops at the first error. Switch to AVERAGE(IF(ISNUMBER(...))) or AGGREGATE.
  2. Forgetting to change the option argument – Using option 1 (ignore hidden rows) instead of 6 still produces an error if any error value is present.
  3. Applying array formulas incorrectly – Older Excel versions require Ctrl + Shift + Enter for AVERAGE(IF()). Missing this step leads to wrong results or a single-cell output of zero.
  4. Not handling “all-error” cases – When the entire range is errors, AGGREGATE returns #DIV/0!. Always wrap with IFERROR or test with COUNT to avoid surprises.
  5. Overlooking hidden rows – If data is filtered, option 6 continues to include hidden rows, possibly skewing the average. Decide if you need option 7 instead.

Alternative Methods

MethodFormula ExampleExcel VersionProsCons
AGGREGATE=AGGREGATE(1,6,DataRange)2010+Simple, fast, no array entryNot in 2007-
AVERAGE with IF + ISNUMBER[=AVERAGE(IF(ISNUMBER(DataRange),DataRange))]2007+Works pre-2010, flexible criteriaRequires array entry or dynamic arrays, slower
FILTER + AVERAGE=AVERAGE(FILTER(DataRange,ISNUMBER(DataRange)))Microsoft 365Intuitive, easily chains criteriaNot available in perpetual licenses
AVERAGEIF(S) with helper column=AVERAGEIF(Helper,">0")2007+Avoids arrays, clearer logicNeeds extra column, still fails on errors inside helper
Power QueryClean errors then load to tableExcel 2010+ (with add-in)Automates heavy ETL, reproducibleAdds refresh steps, larger learning curve

When to choose each:

  • Legacy environments – Use array AVERAGE(IF()).
  • Modern Microsoft 365FILTER plus AVERAGE offers greatest flexibility.
  • Large data models – Power Query cleans upstream before formulas ever calculate, improving workbook size and speed.
  • Quick fix in mixed-version teamsAGGREGATE provides compatibility back to 2010 with no special keys.

FAQ

When should I use this approach?

Use AGGREGATE when you need a quick, maintainable way to return an average from a range that may contain any type of Excel error, especially if your workbook is shared among users running Excel 2010 or later.

Can this work across multiple sheets?

Yes. Reference multiple sheets using a 3-D range (e.g., Sheet1:Sheet12!B2:B100) or named ranges. AGGREGATE processes the entire reference and still ignores errors.

What are the limitations?

AGGREGATE cannot apply complex conditional logic beyond ignoring errors and hidden rows. If you need criteria such as “average positive numbers from Region = North”, combine FILTER or AVERAGEIFS with error checks instead.

How do I handle errors?

If the entire input range results in no numeric values, the formula returns #DIV/0!. Wrap your AGGREGATE (or any method) in IFERROR, or test with COUNT(DataRange) to display a custom message.

Does this work in older Excel versions?

AGGREGATE is unavailable in Excel 2007 and earlier. For those versions, use the array formula [=AVERAGE(IF(ISNUMBER(DataRange),DataRange))]. Remember to confirm with Ctrl + Shift + Enter.

What about performance with large datasets?

AGGREGATE is efficient because it bypasses complex logical checks internally. For data sets exceeding 100 000 rows, consider cleaning errors in Power Query first, or compute averages on aggregated subsets (e.g., per month) then roll up.

Conclusion

Calculating averages while ignoring error values is a foundational Excel skill that keeps dashboards alive, decisions data-driven, and analyses trustworthy. By adopting AGGREGATE or one of the alternative techniques covered, you safeguard your metrics from common data issues without resorting to manual cleanup. Mastery of this topic also strengthens your understanding of arrays, logical tests, and performance optimisation—skills transferrable to dozens of other Excel challenges. Keep experimenting with these methods, integrate them into templates, and you will elevate both the resilience and professionalism of your spreadsheets.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.