Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Ignoring N/A Values in a Sum.

# Ignoring N/A Values in a Sum

by Allen Wyatt
(last updated August 30, 2019)

Chris has a series of worksheets in a workbook, one for each month of the year. On a summary worksheet he wants to sum the values in the same cell on each worksheet. Chris does this by using a formula similar to the following:

```=SUM(January:December!B19)
```

This works fine, except for those instances where one of the B19 cells in the range may contain the value #N/A. In that case, Chris gets #N/A in the result on the summary sheet, as well. What Chris would like is to have the #N/A results ignored for the sum, as if the cells were blank.

There are a couple of ways to approach this problem. Perhaps the best method is to look at the formula used in cell B19 of each month's worksheet. For instance, let's say that the formula on each worksheet looked like this:

```=SUM(B1:B18)
```

You could change the formulas on these individual worksheets so that they took the possibility of #N/A values into account. For instance, the following would work just fine at B19 on each worksheet:

```=SUMIF(B1: B18,"<>#N/A")
```

This causes the sum in cell B19, on each worksheet, to be based on all the non-N/A values in the range. Because of this, you might think you could do this on the summary sheet:

```=SUMIF(January:December!B19,"<>#N/A")
```

This won't work, however, because the SUMIF function is not "three-dimensional" in nature; it cannot be used on a range of worksheets in the manner shown. It is for this reason that the best solution is to go back to the individual values, on each worksheet, that are being tallied on the summary worksheet.

If your formula on the individual month worksheets don't use the SUM function, it is obviously not as easy to change them to use SUMIF. In that case, you may want to "enclose" the existing formula in a check to see if the formula returns an error value. This technique is done this way:

```=IFERROR(<current_B19_formula>,0)
```

The IFERROR function simply checks to see if there is an error returned by the formula. If there is, then it returns 0; if there isn't, then it returns the result of the formula.

There is a big difference between the IFERROR approach and using the SUMIF approach mentioned earlier. The SUMIF approach returns a sum for all non-N/A values in the range, but the IFERROR approach returns a 0 for the entire sum if there are any #N/A values in the range. This can obviously affect what shows up on your summary sheet, so you will need to determine which approach is best suited to the data you are working with.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10233) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Ignoring N/A Values in a Sum.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Measurement of Choice Isn't Persistent

Normally, Word allows you to specify what measurement units you want used for the program; just choose Tools | Options | ...

Discover More

Size Limit for Documents

Word can handle large documents, but how large is large? This tip examines the issue and provides some advice on how ...

Discover More

Printing Color Separations with VBA

When printing in color (at a commercial printer) it is necessary to print different colors of your document in different ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

##### More ExcelTips (ribbon)

Returning Zero When a Referenced Cell is Blank

Reference a cell in a macro, and if that cell is blank Excel normally equates that to a zero value. What if you don't ...

Discover More

Criteria-Based Counting in a Filtered Column

The filtering capabilities of Excel are excellent, providing you with great control over which records in a worksheet are ...

Discover More

Creating an Amortization Schedule

An amortization schedule is a report that shows how the outstanding balance on a loan changes with payments made over ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 - 1?

2020-02-17 11:06:52

Roy

@ Dave Bonin: hidden ROWS, not cells or columns.

2019-09-04 16:19:51

Dave Bonin

You can also use the recently-introduced, but little seen AGGREGATE() function.

It operates a little like the SUBTOTAL() function, but allows you to specifically ignore cells with errors, hidden cells, and or cells with nested SUBTOTAL() or AGGREGATE() functions.

For Allen's example above, the formula would be:
= AGGREGATE( 9, 6, B1:B18 )

In this case, the 9 indicates you want to SUM the values in B1:B18.
The 6 indicates you want to ignore error values.

The regular Excel help via the F1 key has simple and clear instructions.

2015-07-20 04:52:36

Duncan Philps-Tate

And if as Kevin McLogan says, the N/A value is coming from a formula, then at the least, applying IFERROR on the subsidiary sheets would solve the problem.

2015-07-19 21:02:32

Kevin McLogan

One thing that this tip alludes to but does not explicitly state is that there is some sort of problem with one or more of the initial formulas.
Although this involves a lot more heavy lifting than quick fixes like IFERROR, it really needs to be addressed.
Back in the day (Excel XP, 2003) Walkenbach had a book called Escape from Excel Hell.
I think this one needs an update.

##### This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.