formula help vlookup

CRAIG20

Board Regular
Joined
Mar 20, 2006
Messages
225
Hi. I have a vlookup formula.

The current formula is =VLOOKUP(IF(P1=0,5,P1),Rebate1,2,FALSE)

However I now have 2 named ranges and whatever is in cell O1 will determine which named range to lookup.

So if Cell O1 = "1" IT LOOKSUP NAMED RANGE "Rebate1" If O1 = "2" it looks up named range "Rebate2"

Can anyone help me expand the vlookup formula to add this condition?

Thanks in advance.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Maybe
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),IF(O1=1,Rebate1,Rebate2),2,FALSE)
 
Upvote 0
Maybe
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),IF(O1=1,Rebate1,Rebate2),2,FALSE)
Hi. Thanks for your help.

I have added a third named range Rebate3.

If O1 = 3 it looks up Rebate3

Can you help me with formula to include the 3 conditions?

Many thanks.
 
Upvote 0
There are at least 3 ways that should work (I haven't tested the last one)
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),IF(O1=1,Rebate1,IF(O2=2,Rebate2,Rebate3)),2,FALSE)
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),CHOOSE(O1,Rebate1,Rebate2,Rebate3),2,FALSE)
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),INDEX((Rebate1,Rebate2,Rebate3),0,0,O1),2,FALSE)
A better way would be to take the second column of Rebate2 and add it to the right of Rebate1 (as column 3), then do the same with Rebate3 (as column 4 of Rebate1), then use
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),Rebate1,O1+1,FALSE)
Which would be much easier to manage if you wanted to add Rebate4, Rebate5, etc.
 
Upvote 0
Solution
There are at least 3 ways that should work (I haven't tested the last one)
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),IF(O1=1,Rebate1,IF(O2=2,Rebate2,Rebate3)),2,FALSE)
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),CHOOSE(O1,Rebate1,Rebate2,Rebate3),2,FALSE)
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),INDEX((Rebate1,Rebate2,Rebate3),0,0,O1),2,FALSE)
A better way would be to take the second column of Rebate2 and add it to the right of Rebate1 (as column 3), then do the same with Rebate3 (as column 4 of Rebate1), then use
Excel Formula:
=VLOOKUP(IF(P1=0,5,P1),Rebate1,O1+1,FALSE)
Which would be much easier to manage if you wanted to add Rebate4, Rebate5, etc.
Great. Thank you very much
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,042
Members
449,063
Latest member
ak94

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