Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I sum a named range of values that contains errors?

I have an Excel spreadsheet which imports data from another source that I need to run a calculation on. The data I need to work with is in a named range - it happens to be in the range C12:C36 - but it's called "SumData".

The values in this range contain a number of errors currently including #NUM! and #N/A, but could potentially contain other errors. I need to sum these values.

I understand how to do the sum formula:

=SUM(SumData)

Or

=SUM(C12:C36)

I can also use IFERROR to check for errors:

=IFERROR(C12:C36, 0)

But IFERROR only appears to check the current corresponding row to the formula I'm entering. i.e. if my formula is being entered in D12, it only checks for error on row C12, and returns the value (or 0 if C12 contains an error).

If I combine the two to do:

=SUM(IFERROR(SumData,0))

I don't get a valid return value. It basically gives me the nearest corresponding row - for instance:

    C      D
    -----------
12  #NUM!  
13  2      =SUM(IFERROR(SumData,0)) = 2 (I would expect this to produce 48)
14  5
15  7
16  #N/A
17  23
18  6
19  5

What am I doing wrong?

like image 756
BobTheBuilder Avatar asked Jan 19 '11 19:01

BobTheBuilder


2 Answers

=SUM(IF(ISNUMBER(SumData),SumData))

entered as an array formula... ie using CTRL+Shift+Enter and NOT just Enter. If you do it correctly then Excel will put curly brackets around the formula{}.

like image 151
Mark Baker Avatar answered Nov 14 '22 20:11

Mark Baker


Try Use this Formula if you tend to add a range of cells that contains error:

=SUMIFS(sumrange,criteria range1,"<>"&"#NAME?",criteria range2,"<>"&"#N/A",criteria range3,"<>"&"NUM!")

Since you don't know which cell has the error, then it is advisable to use the criteria ranges same as the sumrange.

like image 34
Celo Avatar answered Nov 14 '22 20:11

Celo