New Tool Radar

AI for Data & Spreadsheets

How to Total a Column That Contains Errors With AGGREGATE

Total a column that holds #N/A or #DIV/0! with AGGREGATE, and count the skipped lines so no amount goes missing unnoticed.

Schematic with three steps: Count the error rows first; Total with AGGREGATE; Show the skipped count beside the total.

One error in a range breaks SUM: the whole total becomes #N/A. AGGREGATE with option 6 ignores error values while totalling, and SUM with IFERROR does the same; either way, count the skipped lines, because in accounting work a skipped line is a missing amount.

What you need

  • Excel with the column that contains errors
  • A note of which rows hold errors and why
  • A copy of the workbook

Step 1: Count the error rows first

Before totalling, count the problem lines with =COUNTIF(range,’Not found’) or by filtering for errors. Write the count down; the total that follows is only safe if the skipped lines are counted.

Step 2: Total with AGGREGATE

Enter =AGGREGATE(9,6,range), where 9 means SUM and 6 means ignore error values. The formula totals the good rows and skips the errors; it works in Excel 2010 and later.

Step 3: Show the skipped count beside the total

Put the error count in a cell beside the total with a label, so the total of 240.50 is always read with its warning that one line was skipped. Fix the skipped lines from the source rather than leaving them skipped.

Worked example: synthetic price column with one #N/A

The table below is a synthetic example. It shows the expected result of totalling around errors; no workbook was opened.

Formula Result Note
=SUM(range) #N/A Broken by one error
=AGGREGATE(9,6,range) 240.50 Skips the error
=SUM(IFERROR(range,0)) 240.50 Same result
Lines skipped 1 Shown beside the total

Expected result (UNTESTED). SUM returns #N/A, while AGGREGATE and SUM with IFERROR both return 240.50, with 1 skipped line counted and shown beside the total. The skipped line must be fixed from the source. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Totals that skip errors are convenient, but a skipped line is a missing amount.
  • SUM with IFERROR needs Ctrl+Shift+Enter in older Excel versions; AGGREGATE does not.
  • Fix the cause of each error; a total that skips errors is a workaround, not a fix.

Sources

See all