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
 

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
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:
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,537
Members
449,088
Latest member
RandomExceller01

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