How to return blank result if no match for VLOOKUP?

tkroper

Active Member
Joined
Feb 2, 2007
Messages
255
I'm using this formula (thanks to dafan & HalfAce http://www.mrexcel.com/forum/showthread.php?p=1604964&posted=1#post1604964)
Code:
=IF(VLOOKUP($A177,$A$736:$C$787,3,FALSE)=0,"",VLOOKUP($A177,$A$736:$I$787,3,FALSE))
to return the value located in the 3rd column of the range when the value in the 1st column of the range matches the data in A177.

However, there isn't a match for the data in A178 in the range, so the formula returns "#N/A". I would like the cell containing the formula to remain blank in those instances. Is there a way to do this?

Thank you very much for your help!

Todd
 
That's still not very efficient, since you're performing the VLOOKUP twice. There was a missing argument in my previous post. Try the following:

=IF(COUNTIF($A$736:$A$787,$A177),VLOOKUP($A177,$A$736:$C$787,3,FALSE),"")

Yes - I see what you mean, Neil - and it works perfectly! Thank you very much :)
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
What about adding an If(iserrr( to the beginning?

Thank you spcalan - in my formula, using "isna" accomplished what I needed, but Neil's solution was much better and more efficient. I do appreciate your help though - thank you very much!
 
Upvote 0
That's still not very efficient, since you're performing the VLOOKUP twice. There was a missing argument in my previous post. Try the following:

=IF(COUNTIF($A$736:$A$787,$A177),VLOOKUP($A177,$A$736:$C$787,3,FALSE),"")

Neither is CountIf: See

http://www.mrexcel.com/forum/showthread.php?t=38643


Options (where match-type = 0) from highly efficient to less efficient...

[1]
Code:
=IFERROR(INDEX($C$736:$C$787,MATCH($A177,$A$736:$A$787,0)),"")
Required: Excel 2007 or beyond.

[2]
Code:
=IF(ISNUMBER(SETV(MATCH($A177,$A$736:$A$787,0))),
    INDEX($C$736:$C$787,GETV()),"")
Required: morefunc.xll add-in

[3]
Code:
=IF(LOOKUP($A177,$A$736:$A$787)=$A177,
    LOOKUP($A177,$A$736:$A$787,$C$736:$C$787),
    "")
Required: $A$736:$C$787 must be sorted in ascending order on column A.

[4]

Y177:
Code:
=MATCH($A177,$A$736:$A$787,0)

X177:
Code:
=IF(ISNUMBER($Y177),INDEX($C$736:$C$787,$Y177),"")

Required: Additional formula cells.

[5]
Code:
=IF(ISNUMBER(MATCH($A177,$A$736:$A$787,0)),
    INDEX($C$736:$C$787,MATCH($A177,$A$736:$A$787,0)),
    "")

[6]

VLOOKUP versions of [1], [2], [4], and [5].

[7]
Code:
=IF(COUNTIF($A$736:$A$787,$A177),
    INDEX($C$736:$C$787,MATCH($A177,$A$736:$A$787,0)),
    "")

Compare the above list with one posted much earlier:

http://www.mrexcel.com/forum/showthread.php?t=59718
 
Upvote 0
Wow Aladin! That's a lot of good information - thank you very much. I'm going to have fun exploring all of your suggestions. :)
 
Upvote 0

Forum statistics

Threads
1,215,366
Messages
6,124,516
Members
449,168
Latest member
CheerfulWalker

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