If vlookup is blank in one column, then vlookup in another column

Groovicles

Board Regular
Joined
Nov 27, 2013
Messages
52
Hi everyone,

I have the following formula:

=IF(ISNA(VLOOKUP(A9,'c:xyz'!$F$3:$CG$6472,64,FALSE)),"",(VLOOKUP(A9,'c:xyz'!$F$3:$CG$6472,65,FALSE)))

So what I'm trying to do, is that vlookup to column 64 is blank, then do a vlookup on column 65. The formula is not working. Its only reading one column, but if its blank its not reading the next, its only showing a blank result. Any ideas?

Thanks everyone!
 
Yes, the ones with the wrong results appear to all have spaces in them. That should be it. Thanks very much for your help etaf.
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi etaf,

I've got an extended question. I'm wondering, how could i extend this formula to cover a total of 5 columns instead of 2 (64-68). I couldn't be that I'd just write them one after another in a nested if statement, would it?
 
Upvote 0
dont understand

your not using 2 columns , your using $F$3:$CG$6472 F to CG hence the need for 64 and 65

the lookup uses the column you specify first in your range so in this case F

if you only wanted 2 columns
then F:G
and you can use the numbers , 1 for F and 2 for G
 
Upvote 0
Hi everyone,

I have the following formula:

=IF(ISNA(VLOOKUP(A9,'c:xyz'!$F$3:$CG$6472,64,FALSE)),"",(VLOOKUP(A9,'c:xyz'!$F$3:$CG$6472,65,FALSE)))

So what I'm trying to do, is that vlookup to column 64 is blank, then do a vlookup on column 65. The formula is not working. Its only reading one column, but if its blank its not reading the next, its only showing a blank result. Any ideas?

Thanks everyone!

Assumption: VLOOKUP, if successful, returns text (the length of which > 0).

=LOOKUP(REPT("z",255),VLOOKUP(A9,'c:xyz'!$F$3:$CG$6472,{64,65},0))
 
Upvote 0
Hi etaf,

Sorry. So the vlookup is searching columns 64 and 65. If 64 is blank, then 65 is used. What I'm asking if that can be extend to 68. So if columns 64 and 65 are blank, then 66 is used. If those three are blank, then 67, etc.
 
Upvote 0
Hi etaf,

Sorry. So the vlookup is searching columns 64 and 65. If 64 is blank, then 65 is used. What I'm asking if that can be extend to 68. So if columns 64 and 65 are blank, then 66 is used. If those three are blank, then 67, etc.

Have also a look at post #15.
 
Last edited:
Upvote 0
Hi Aladin,

Thank you for your reply. I must say i only understand about half of the formula you suggested. What does =LOOKUP(REPT("z",255) mean? Also, I assume {64,65} could be expanded to {64,65,66,67,68} if needed, correct?

Thanks!
 
Upvote 0
Hi Aladin,

Thank you for your reply. I must say i only understand about half of the formula you suggested. What does =LOOKUP(REPT("z",255) mean?

REPT("z",255) is the lexically 'biggest" string which is improbable to occur in references of interest to us. When used as the look up value in LOOKUP (and kindred functions), we get the last text value in the reference with which the function is fed.

Also, I assume {64,65} could be expanded to {64,65,66,67,68} if needed, correct?

Yes, exactly.


You are welcome.
 
Upvote 0
hi Aladin,

Your suggestions works perfectly. Thank you very much for your help and your explanation. I was not aware of the REPT function.
 
Upvote 0

Forum statistics

Threads
1,225,223
Messages
6,183,666
Members
453,179
Latest member
mstav

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