IF with VLookup Formula

Sundance_Kid

Board Regular
Joined
Sep 2, 2017
Messages
128
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Looking for help with a formula using an IF & Vlookup function please :)

I want to say if cell E8 = X then vlookup value in cell F8 in table array D2:F10,column 3, if E8 = Y, then vlookup value in cell F8 in table array D2:G10,column 4, if it is something else in cell E8 return "Check".

I can get the first part but thats it.

Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Maybe
=IF(OR(E8<>{"X","Y"}),"Check",VLOOKUP(F8,D2:F10,IF(E8="X",3,4),0))

But why are you using values in the lookup table?
 
Upvote 0
Maybe:

=IF(OR(E8={"X","Y"}),VLOOKUP(F8,D2:G10,3+(E8="Y"),0),"Check")

The description is a little odd, since your E8 and F8 values are in the middle of your table.
 
Upvote 0
Oops, mine should have been
=IF(AND(E8<>{"X","Y"}),"Check",VLOOKUP(F8,D2:F10,IF(E8="X",3,4),0))
 
Upvote 0
Sorry the values in the lookup table are in a different tab.

This is what I am trying to do, but i know its wrong.

=IF(E8="X",VLOOKUP(F8,OtherTab!$D$2:$F$10,3,IF(E8="Y",VLOOKUP(F8,OtherTab!$D$2:$G$10,4,"Check"))))
 
Upvote 0
You weren't too far off with your formula:

=IF(E8="X",VLOOKUP(F8,OtherTab!$D$2:$F$10,3),IF(E8="Y",VLOOKUP(F8,OtherTab!$D$2:$G$10,4),"Check"))

but Fluff's or my version would shorten it a bit:

=IF(OR(E8={"X","Y"}),VLOOKUP(F8,OtherTab!D2:G10,3+(E8="Y"),0),"Check")
 
Upvote 0
@Sundance_Kid
You have a couple of the brackets in the wrong place
=IF(E8="X",VLOOKUP(F8,OtherTab!$D$2:$F$10,3),IF(E8="Y",VLOOKUP(F8,OtherTab!$D$2:$G$10,4),"Check"))
At the moment your lookup is doing an approximate match, rather than an exact match, not sure if that's what you wanted.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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