excelexcel-formulavlookup

VLOOKUP Returns 0 even though there is a value in the line below the first result


I am having a problem with my vlookup.

I have data that is in the following format: (see screenshot)

VLOOKUP PROBLEM IM HAVING

I ran my VLOOKUP formula as =VLOOKUP(C6:C11,named_range,2,FALSE)

"named_range" is what i used for my named range so that everything was an absolute reference. The named range is the entire selection on the right

I know that vlookup returns the value of the first result it finds, which is why "0" is returned for Steve, Ben, and Jane.

However I am trying to figure out how I can make it do the following:

If the vlookup finds a matching value that has a blank cell associated with it, look down the list until you find that matching value that has somthing in the cell next to it.

Here is the expected result that I would like (this is made manually of course):

Expected Result

I have done a ton of research but cannot find a way to solve this problem... I was leaning in the direction of MATCH and INDEX but nothing seemed to fit my requirements.

Thanks in advance hope I explained ok.


Solution

  • The simplest way I can think of to do this is to add a test to see if the cells are blank:

    =VLOOKUP(C6,IF(ISBLANK($L$6:$L$18),0,$K$6:$L$18),2,FALSE)
    

    This is an array formula, so it will need to be entered using Ctrl+Shift+Enter.