Vlookup and If Statement

dneas

New Member
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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
if you're comfortable with vlookups in general, the following thread should give you some ideas:

http://mrexcel.com/board/viewtopic.php?topic=9893&forum=2

note especially the formulas Aladin uses in his spreadsheet simulation & which ones he recommends.

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.

=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

For the #na issue, I usually use IFERROR.
IE: =IFERROR(VLOOKUP,RANGE,COLUMN,FALSE),0)

Replies
5
Views
219
Replies
4
Views
242
Replies
5
Views
146
Replies
1
Views
61
Replies
1
Views
268

1,218,691
Messages
6,143,941
Members
450,516
Latest member
shironokuro

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.

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

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