Condition two options, Vlookup 2 worksheets

sitzalke

New Member
Joined
May 13, 2019
Messages
11
Hi, good evening everyone.

I would like to ask question that I've been stuck for a very long time, so I made a decision to ask in this forum.
Roughly, I have TWO(2) worksheets. One sheet is Onhand, another sheet is input.

This is table for sheet Onhand,
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Column A[/TD]
[TD]Column B[/TD]
[TD]Loc[/TD]
[/TR]
[TR]
[TD]Chicken[/TD]
[TD]MV1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fish[/TD]
[TD]MV2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Rabbit[/TD]
[TD]Mv3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Butterfly[/TD]
[TD]Mv4[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


This is table for sheet input, in this sheet input, there are TWO(2) tables.

This table 1 is, if Column A in Sheet Onhand = Chicken Or Fish
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Sloc[/TD]
[TD]Loc[/TD]
[/TR]
[TR]
[TD]Mv1[/TD]
[TD]alien[/TD]
[/TR]
[TR]
[TD]mv2[/TD]
[TD]alien[/TD]
[/TR]
[TR]
[TD]mv3[/TD]
[TD]tupper[/TD]
[/TR]
[TR]
[TD]mv4[/TD]
[TD]cheese[/TD]
[/TR]
</tbody>[/TABLE]

This table 2 is, if Column A in Sheet Onhand = Butterfly OR Rabbit
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Sloc[/TD]
[TD]Loc[/TD]
[/TR]
[TR]
[TD]Mv1[/TD]
[TD]alien[/TD]
[/TR]
[TR]
[TD]mv2[/TD]
[TD]alien[/TD]
[/TR]
[TR]
[TD]mv3[/TD]
[TD]tupper[/TD]
[/TR]
[TR]
[TD]mv4[/TD]
[TD]cheese[/TD]
[/TR]
</tbody>[/TABLE]


My question is,
I need to do,
if (Column A in Sheet OnHand = chicken OR Column A = Fish), then Column "Loc" will VLOOKUP with table 1.
if (Column A in Sheet OnHand = Butterfly OR Column A = Rabbit), then Column "Loc" will VLOOKUP with table 2.

Help me,...
I'm not sure how to vlookup with so many options with two table. I've try so many type of vlookup, but doesn't work. T_T

Thankyou in advance! :)
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
This should work:

=VLOOKUP(B2,CHOOSE(LOOKUP(A2,{"Butterfly","Chicken","Fish","Rabbit"},{2,1,1,2}),Table1,Table2),2,0)
 
Upvote 0
This should work:

=VLOOKUP(B2,CHOOSE(LOOKUP(A2,{"Butterfly","Chicken","Fish","Rabbit"},{2,1,1,2}),Table1,Table2),2,0)

Oh, Sorry but I already found the solution. Thanks, The solution is like this,

Code:
=IF(OR(E2="Chicken",E2="Fish"),VLOOKUP(M2,LOC!A:B,2,0),VLOOKUP(M2,LOC!D:E,2,0))
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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