How to Sum and Ignore Errors in Excel
By ExcelReady TeamUpdated 6 min read
The short answer
To sum a range and ignore errors in Excel, use =AGGREGATE(9,6,B2:B7), where 9 means SUM and 6 means ignore error values. Or use =SUM(IFERROR(B2:B7,0)), which turns each error into 0 before adding. Both skip #N/A, #DIV/0! and other errors. Fixing the errors at the source is often the better long-term answer.
Key takeaways
- SUM returns an error if any cell in the range contains one.
- =AGGREGATE(9,6,range) sums and skips errors; option 7 also skips hidden rows.
- =SUM(IFERROR(range,0)) works as a normal formula in Excel 2021 and Microsoft 365.
- =SUMIF(range,"<9.99E+307") skips errors in any version without special keys.
- A total that skips errors can hide missing data, so count the errors too.
On this page+
To sum and ignore errors in Excel, use =AGGREGATE(9,6,B2:B7) or =SUM(IFERROR(B2:B7,0)). A plain SUM stops at the first error and shows it as the result, so one #N/A from a lookup or one #DIV/0! breaks the whole total. This guide shows three formulas that skip errors, when to use each, and how to find the errors so you don't hide a real problem.
Why SUM returns an error#
SUM adds numbers, and it skips text and blank cells. But if any cell in its range holds an error value, such as #N/A, #DIV/0! or #VALUE!, SUM returns that error instead of a total. Here is a store report where two cells failed:
| A | B | |
|---|---|---|
| 1 | Store | Sales |
| 2 | Leeds | 1,250 |
| 3 | York | #DIV/0! |
| 4 | Hull | 980 |
| 5 | Bath | 1,410 |
| 6 | Derby | #VALUE! |
| 7 | Ely | 760 |
=SUM(B2:B7) returns #DIV/0!, not a number. The total of the four good cells is 4,400 (1,250 + 980 + 1,410 + 760). Every method below returns 4,400. If SUM itself is new to you, start with the SUM function guide or the article on using SUM in Excel.
Method 1: Sum and ignore errors with AGGREGATE#
AGGREGATE does SUM, AVERAGE, MAX and more, and it can skip errors. The syntax is:
=AGGREGATE(function_num, options, ref1, ...)For a sum that ignores errors:
=AGGREGATE(9,6,B2:B7)- 9 tells AGGREGATE to SUM.
- 6 tells it to ignore error values.
- B2:B7 is the range.
The result is 4,400. AGGREGATE works in Excel 2010 and later, on Windows and Mac. Excel shows a list of function numbers and options as you type, so you don't have to remember them.
Two other options are worth knowing. Option 7 ignores errors and hidden rows, which is useful on a filtered list. Option 5 ignores hidden rows only. Change the first number to get other results: 1 for AVERAGE, 4 for MAX, 5 for MIN. For example, =AGGREGATE(4,6,B2:B7) returns the highest sale, 1,410.
AGGREGATE has one limit to know. With a range like B2:B7, it skips errors and, with option 7, hidden rows. But if you give it a calculation instead of a range, such as B2:B7*2, only some of its functions accept that. For a plain total of a column, the form shown here always works.
Method 2: Sum and ignore errors with SUM and IFERROR#
Wrap the range in IFERROR to turn each error into 0, then add:
=SUM(IFERROR(B2:B7,0))IFERROR checks each cell in B2:B7. Numbers pass through unchanged, and errors become 0. SUM then adds the clean list and returns 4,400. The IFERROR function guide explains the two arguments.
In Excel 2021 and Microsoft 365, press Enter as usual. In Excel 2019 and earlier, this is an array formula, so confirm it with Ctrl+Shift+Enter. If you press plain Enter in an older version, you may get the wrong answer or an error.
To skip only #N/A and still see other errors, use IFNA instead: =SUM(IFNA(B2:B7,0)). On this data it still returns #DIV/0!, because IFNA doesn't catch that error. That is useful when a missing lookup value is expected but a division error is a real bug.
Method 3: The SUMIF trick for any version#
SUMIF only adds cells that meet its criteria, and an error never meets a number test. So a criteria that every normal number passes will skip all errors:
=SUMIF(B2:B7,"<9.99E+307")9.99E+307 is close to the largest number Excel can store, so every real number is smaller. The result is 4,400, with no special keys and in every version of Excel. The downside is that the formula is hard to read, so add a note for whoever opens the file next.
Which method should you use?#
All three give the same total. Pick by version and by what else you need.
| Method | Formula | Works in | Best for |
|---|---|---|---|
| AGGREGATE | =AGGREGATE(9,6,B2:B7) | Excel 2010 and later | Most cases, filtered lists (option 7) |
| SUM + IFERROR | =SUM(IFERROR(B2:B7,0)) | Enter in 2021/365; Ctrl+Shift+Enter before | Readable formulas, skipping only #N/A with IFNA |
| SUMIF | =SUMIF(B2:B7,"<9.99E+307") | All versions | Very old files, no array formulas |
SUBTOTAL is not on the list. It ignores hidden rows but not errors, so one error still breaks it. The comparison of SUBTOTAL vs SUM explains what SUBTOTAL does skip. For a total of only the rows a filter shows, see how to filter and sum.
How to fix errors at the source#
Skipping errors in the total is quick, but the errors are still in the sheet. Often it is better to stop them appearing. If column B is filled by formulas, wrap each one:
=IFERROR(VLOOKUP(A2,Prices!A:B,2,FALSE),0)Now each row shows 0 instead of #N/A, and a plain SUM works. Use this only when 0 is a true answer. If a store's sales are unknown, a blank ("") is more honest than 0, and SUM skips blanks too.
The same idea applies across a wider sheet or several sheets. The guides to summing multiple columns and summing across sheets work with any of these methods.
How to count the errors you skipped#
A total that quietly leaves out two stores can mislead as much as an error. Count the errors next to the total:
=SUMPRODUCT(--ISERROR(B2:B7))ISERROR returns TRUE for each error. The double minus (--) turns TRUE into 1 and FALSE into 0, and SUMPRODUCT adds them. The result is 2. A label such as "Total 4,400 (2 stores missing)" tells readers exactly what they are looking at.
To find the error cells themselves, use Home > Find & Select > Go To Special, choose Formulas, and tick only Errors. Excel selects every formula cell that shows an error.
Practise it#
Practise IFERROR in a live spreadsheet: you wrap formulas that fail and the sheet checks your answer instantly. Then try the exercise on this page, which totals a column with two errors, and review the basics in the SUM lesson.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Two stores show errors, so a plain SUM fails. In D2, total the Sales column (B2:B7) and ignore the errors with SUM and IFERROR.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Sales | Total sales | |||
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 | |||||
| 6 | |||||
| 7 | |||||
| 8 | |||||
| 9 | |||||
| 10 |
Tip: IFERROR(B2:B7,0) turns every error in the range into 0. Put it inside SUM.
Practise this in a lesson
Frequently asked questions
How do I sum a column with #N/A in Excel?
Use =AGGREGATE(9,6,B2:B7) or =SUM(IFERROR(B2:B7,0)). Both add the numbers and skip the #N/A cells. To skip only #N/A, use =SUM(IFNA(B2:B7,0)).
Why does my SUM formula return #N/A or #DIV/0!?
One or more cells in the range contain that error, and SUM passes the first error it meets on to the result. Find the error cells and fix them, or use AGGREGATE to skip them.
Does SUBTOTAL ignore errors?
No. SUBTOTAL ignores hidden and filtered rows, but an error in a visible cell still breaks the result. Use AGGREGATE with option 7 to skip both hidden rows and errors.
How do I average and ignore errors?
Use AGGREGATE with function 1 for AVERAGE: =AGGREGATE(1,6,B2:B7). It averages only the cells that hold numbers.
How do I count the errors in a range?
Use =SUMPRODUCT(--ISERROR(B2:B7)). ISERROR returns TRUE for each error, the double minus turns TRUE into 1, and SUMPRODUCT adds them up.