VLookUp and If

Sparta_leadhead

New Member
Joined
Jul 13, 2008
Messages
6
Hey guys.

I have a Vlookup as follows:

=VLOOKUP(M5,'Hits on Portal'!A4:D145,3,FALSE)

This searches for a certain name in a list, and returns a value in column 3 (a number), which works fine.

The problem comes when the name im looking for is not in the table the Vlookup searches, and returns #N/A.

How can i nest an IF fucntion to the formula above so that if the value returned from the Vlookup is #N/A, it is change to 0.

Thanks in advance
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
You could either reiterate the lookup with an ISNA/ISERROR check or use a Match test in first instance (so only referencing one column)

=IF(ISNUMBER(MATCH(M5,'Hits on Portal'!A4:A145,0)),VLOOKUP(M5,'Hits on Portal'!A4:C145,3,FALSE),0)

Note as you're returning C from your range no need to reference D in the range.

HTH
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,123,514
Messages
5,602,093
Members
414,501
Latest member
mdhaumyu

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