Vlookup and If Statement

dneas

New Member
Joined
Mar 3, 2002
Messages
34
Is there anyway to write just ONE formula to get 0 when the #N/A is a result in the Vlookup?
Here is my Example:

Column H
=IF(VLOOKUP(A2,Sheet1!$A$4:$B$38,2,0),"0",VLOOKUP(A2,Sheet1!$A$4:$B$38,2,FALSE))

Column I
=ISNA(H2)

Column J
=IF(I2=TRUE,"0",H2)
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
On 2002-09-01 15:47, dneas wrote:
Is there anyway to write just ONE formula to get 0 when the #N/A is a result in the Vlookup?
Here is my Example:

Column H
=IF(VLOOKUP(A2,Sheet1!$A$4:$B$38,2,0),"0",VLOOKUP(A2,Sheet1!$A$4:$B$38,2,FALSE))

Column I
=ISNA(H2)

Column J
=IF(I2=TRUE,"0",H2)

You should have:

In H2: =VLOOKUP(A2,Sheet1!$A$4:$B$38,2,0)

In I2: =IF(ISNA(H2),0,H2)

Note. I replaced FALSE with 0 which means the same thing to Excel.

The foregoing is one way to avoid #N/A. Other, single formula, alternatives are discussed in the thread Paddy quotes.

An additional option is:

=IF(ISNA(SETV(VLOOKUP(A2,Sheet1!$A$4:$B$38,2,0))),"",GETV())

if you and your users have installed the morefunc add-in, available from:

http://longre.free.fr/english/index.html
 
Upvote 0

Forum statistics

Threads
1,222,900
Messages
6,168,926
Members
452,227
Latest member
sam1121

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