Classing an #N/A as a zero value

Fractured

New Member
Joined
Apr 13, 2004
Messages
21
I've had a bit of a search and haven't been able to find anything relating to what I need to do.

Is there a way of creating a sum or vlookup formula that will consider any #N/A value returned as a zero? For instance:

=SUM(C2:C3)

Can I produce a result of zero (or 3, for arguments sake, if C2=#N/A and C3=3) if either or both cells contain an #N/A?

Alternatively:

=VLOOKUP($A2,Workings!$E:$M,2,FALSE)

Is there a way of returning a zero value (as opposed to #N/A) if the value in A2 doesn't appear within the defined range (ie Workings!E:M)?

I realise that a simple sum or vlookup formula will not do this but am hopeful that there may be an alternative.

Nick
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
My word. It's all so simple when you know how!

Thanks James. That's awesome mate.

Take it easy,

Nick
 
Upvote 0
Jimbo's code answers your first question.

Here is how I deal with your second question:

Alternatively:

=VLOOKUP($A2,Workings!$E:$M,2,FALSE)

Is there a way of returning a zero value (as opposed to #N/A) if the value in A2 doesn't appear within the defined range (ie Workings!E:M)?

In place of your forumula enter:
=if(isna(VLOOKUP($A2,Workings!$E:$M,2,FALSE)),0,VLOOKUP($A2,Workings!$E:$M,2,FALSE))

Now anytime the vlookup returns #N/A, the if formula will give you a 0.

Let me know if this does what you need.
 
Upvote 0
Thank you all for your input. All of those suggestions are equally good and useful.

Thanks again,

Nick
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,812
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top