VLOOKUP with multiple hits

SamueXCEl

New Member
Joined
Aug 6, 2019
Messages
9
Hi - I'm looking to do a VLOOKUP that will pull the hit that is not blank.

In column C I have the name I will lookup, and in column N the numbers I want.

e.g.
Dog might be listed 10 times, but if the 1st line of Dog is a blank cell, how do I let VLOOKUP know to move to the 2nd line; or if the 2nd Dog is also blank, the 3rd line; etc.

Thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
VLOOKUP cannot do that. It will only return the values from the first match it finds.
However, if you sort your data, first on the field that you are matching ("Dog"), and then by the field you want to return in DESCENDING order (so the blanks fall to the bottom of the list), then your VLOOKUP should work.
 
Upvote 0
Hi Joe - thanks, but the VLOOKUP is on a tab, that pulls data from another one. It is a summary of the source, my intention is for it to be a standalone tab.

I don't really want the source tab to be data sorted, because each time data is added (more cats or dogs), I'll have to change one tab for another - and then revert back for adding animals
 
Upvote 0
OK, you should be able to use the method described here: https://exceljet.net/formula/index-and-match-with-multiple-criteria
The first criteria is the value you are looking up.
The second criteria is the column you want to return is not blank.

So, let say that you have two columns, A and B, where you are matching on column A, and returning the value from column B, but want to return the first non-blank match in column B.
If the value you are looking up is in cell D1, then the formula would look something like this:
Code:
{=INDEX(B1:B500,MATCH(1,(A1:A500=D1)*(B1:B500<>"")))}
note that the squiggly brackets indicate that the formula must be entered with CTRL+SHIFT+ENTER, and not just ENTER (as described in that link).
 
Upvote 0

Forum statistics

Threads
1,224,744
Messages
6,180,696
Members
452,994
Latest member
Janick

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