How to vlookup across multiple columns? If blank, then next column

js6425

New Member
Joined
Feb 8, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
What is the best way to create a vlookup to do the following?

Lookup Value in O123
Vlookup and pull the corresponding value in column 30
If row 30 is blank, then pull the value from column 29
If column 29 is blank, then pull the value from column 28

Does that make sense? Been trying to figure this out all afternoon and am stumped. Thanks!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
use iferror then on each error apply vlookup to select value from another example keep doing unless all columns are covered
 
Upvote 0
Welcome to the Forum!

Do you mean something like this?

ABCDEFGHIJ
1
2LookupLookupTable
3B19A235711
4B131719
5C23
6D
7
Sheet1
Cell Formulas
RangeFormula
B3B3=LET(r,INDEX(D3:I6,MATCH(A3,D3:D6,),),x,FILTER(r,r<>""),IF(COLUMNS(x)=1,"No values",INDEX(x,COLUMNS(x))))
 
Upvote 0
@StephenCrump
Hi Stephen
I think that you might need an extra check for "No values".
One for if there are no values in the matching row (you have this check), and ..
One for if the lookup value does not exist in column D

One adaptation might be:
Excel Formula:
=LET(n,"No values",rw,INDEX(FILTER(E3:I6,D3:D6=A3,n),1,0),c,FILTER(rw,rw<>"",n),INDEX(c,COUNTA(c)))

Another slightly different approach might be:

22 02 09.xlsm
ABCDEFGHI
1
2LookupLookupTable
3B19A235711
4B131719
5C23
6D
Lookup
Cell Formulas
RangeFormula
B3B3=LET(rw,INDEX(FILTER(E3:I6,D3:D6=A3,""),1,0),XLOOKUP(TRUE,rw<>"",rw,"No values",,-1))
 
Upvote 0
Thanks! Is there any way to do this without the LET function?
 
Upvote 0
Thanks! Is there any way to do this without the LET function?
Yes, this is only marginally longer & less efficient

22 02 09.xlsm
ABCDEFGHI
1
2LookupLookupTable
3B19A235711
4B131719
5C23
6D
Lookup (2)
Cell Formulas
RangeFormula
B3B3=XLOOKUP(TRUE,INDEX(FILTER(E3:I6,D3:D6=A3,""),1,0)<>"",INDEX(FILTER(E3:I6,D3:D6=A3,""),1,0),"No values",,-1)
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

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