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

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
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
 

steffanb

New Member
Joined
Mar 26, 2014
Messages
1
For the #na issue, I usually use IFERROR.
IE: =IFERROR(VLOOKUP,RANGE,COLUMN,FALSE),0)
 

Forum statistics

Threads
1,181,643
Messages
5,931,186
Members
436,780
Latest member
doknights

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
Top