Smart Systems for Home

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

Excel Sum Function Ignore Errors: How to Use AGGREGATE

· 5 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 sum a range in Excel while ignoring errors, use the AGGREGATE function with the function number 9 and the option number 6. For example, the formula =AGGREGATE(9, 6, A1:A10) will calculate the total of the specified range while completely skipping any cells containing errors like #N/A, #VALUE!, or #DIV/0!. This is essential because the standard SUM function returns an error if even one cell in the target range is invalid.

What You'll Need

  • Microsoft Excel (Excel 2010 or any newer version, including Office 365).
  • A dataset containing numerical values and at least one error value (such as #REF!, #NAME?, or #DIV/0!).
  • Basic knowledge of how to enter a formula into a cell.

Step-by-Step

  1. Identify your data range: Locate the column or row that contains the numbers you want to total. Note the cell references (e.g., cells B2 through B50). Ensure that the errors you want to ignore are actual Excel error codes and not just text strings that look like errors.
  2. Select the destination cell: Click on the empty cell where you want the final total to appear. This is usually at the bottom of a column or the end of a row.
  3. Start the AGGREGATE formula: Type =AGGREGATE( into the cell. The AGGREGATE function is designed specifically to perform calculations while ignoring hidden rows, error values, or other nested subtotal functions.
  4. Enter the Function Number: Type 9 followed by a comma. In the AGGREGATE function, the number 9 tells Excel that you want to perform a SUM operation. If you were looking for an average, you would use 1; for a maximum value, you would use 4.
  5. Enter the Options Number: Type 6 followed by a comma. The option number 6 specifically instructs Excel to "Ignore error values." This is the critical step that prevents the formula from returning an error result when it encounters a #DIV/0! or #N/A in your range.
  6. Define the Range: Type or select the range of cells you wish to sum. For example, if your data is in column B from row 2 to 50, type B2:B50. Your complete formula should now look like =AGGREGATE(9, 6, B2:B50).
  7. Finalize and Execute: Press the Enter key. Excel will now scan the range, discard any cells that contain errors, and provide the mathematical sum of the remaining valid numbers.

Common Mistakes

One of the most frequent mistakes is using the standard SUM function and expecting it to handle errors automatically. The SUM function is designed to be strict; if it encounters a single error in the range, the entire result becomes that error. Users often try to fix this by manually deleting errors, which destroys the audit trail of why the error occurred in the first place.

Another common error is confusing the function number with the option number. Users sometimes enter =AGGREGATE(6, 9, A1:A10). In this case, Excel thinks you want to use function 6 (which is the PRODUCT function) and option 9 (which ignores hidden rows and error values). This results in a multiplication of the range rather than a sum. Always remember: the first number is what you are doing (Sum = 9), and the second number is how you are doing it (Ignore Errors = 6).

Some users attempt to use the SUMIF function with a criteria like "<9.99E307" to ignore errors. While this technically works for some error types, it is a "hack" that can be confusing for other people reading the spreadsheet and may not capture all types of error values consistently across different Excel versions.

Tips

If you are working with a table that you frequently filter, you can change the option number from 6 to 7. Option 7 ignores hidden rows and error values. This is incredibly powerful for dashboards where you want the total to update dynamically as you filter out specific categories while still ignoring any broken data points in the background.

For those using very old versions of Excel (pre-2010) where AGGREGATE is unavailable, the best alternative is the SUMIF function. You can use =SUMIF(A1:A10, "<>#N/A") to ignore specific errors, or use an array formula like =SUM(IF(ISERROR(A1:A10), 0, A1:A10)). Note that array formulas in older versions require pressing Ctrl+Shift+Enter to activate.

To keep your spreadsheets clean, combine AGGREGATE with conditional formatting. While AGGREGATE allows you to get the total despite errors, the errors are still visible in your cells. You can set a conditional formatting rule to turn the font color of error cells to light grey or white, making the spreadsheet look professional while the AGGREGATE function handles the math behind the scenes.

Troubleshooting

If your AGGREGATE formula is returning a 0 when you know there are numbers in the range, check the formatting of your numbers. Often, numbers are imported as text. AGGREGATE ignores text just as it ignores errors. If your numbers are left-aligned in the cell and have a small green triangle in the corner, they are stored as text. Select the cells, click the warning icon, and choose "Convert to Number."

If the formula returns a #VALUE! error itself, check your syntax. Ensure you have exactly three arguments inside the parentheses: the function number, the option number, and the range. If you accidentally added a fourth argument or missed a comma, Excel will not be able to parse the formula.

If the result seems mathematically incorrect, verify that you haven't accidentally included the total cell itself within the range. This creates a circular reference, which can cause Excel to display 0 or an error message, as the formula is trying to calculate a sum that includes its own result.

Frequently Asked Questions

Can AGGREGATE ignore both errors and hidden rows?

Yes. By changing the option number from 6 to 7, the function will ignore both error values and any rows that have been hidden manually or via a filter.

Does this work for the AVERAGE function as well?

Yes. Simply change the first argument (the function number) from 9 to 1. The formula =AGGREGATE(1, 6, A1:A10) will calculate the average of the range while ignoring errors.

Will AGGREGATE ignore cells that are blank?

Yes, AGGREGATE (and the standard SUM function) naturally ignores empty cells. It treats them as non-values and does not let them affect the calculation.

Is there a difference between AGGREGATE and SUMIFS for this purpose?

Yes. SUMIFS requires a specific criteria to be met to include a cell. AGGREGATE is more flexible because it has a built-in toggle (the option number) to ignore all error types simultaneously without needing to define what those errors are.

Does this work in Google Sheets?

No, the AGGREGATE function is specific to Microsoft Excel. In Google Sheets, you should use the FILTER function combined with ISERROR, such as =SUM(FILTER(A1:A10, NOT(ISERROR(A1:A10)))).