Vlookup with either two lookup value/Column

Joined
Nov 7, 2017
Messages
7
Column 1Column 2
Chicken-
Duck-
Dog-
ButterflySnake
-Pig
-Ant

<colgroup><col><col></colgroup><tbody>
</tbody>

Table
Chicken10
Duck20
Dog30
Snake40
Bear50
Elephant60
Ant70
Pig80

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>




I have a question.
what the formula if my lookup value either two column.
=vlookup(or(column 1,column 2),table,2,true).
But or function cannot be use here.
Help me
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I don't understand what you want, can you show some expected outcomes?
Table
Chicken10
Duck20
Dog30
Snake40
Bear50
Elephant60
Ant70
Pig80

<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>
</tbody>

Column 1Column 2Outcome
Chicken-10
Duck-20
Dog-30
ButterflySnake40
-Pig80
-Ant70

<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>


the outcome should be in third column
 
Upvote 0
Try this...
=IFERROR(VLOOKUP(A12,$A$2:$B$9,2,0),VLOOKUP(B12,$A$2:$B$9,2,0))
copied down
 
Upvote 0
TableColumn 1Column 2Outcome
Chicken10Chicken-10
Duck20Duck-20
Dog30Dog-30
Snake40ButterflySnake40
Bear50-Pig80
Elephant60-Ant70
Ant70
Pig80

<tbody>
</tbody>

In G2 just enter and copy down:

=LOOKUP(9.99999999999999E+307,SEARCH($A$2:$A$9,E2&"|"&F2),$B$2:$B$9)

If both column 1 and column 2 values do exit in the table, the number corresponding to one of them is displayed. If this is not the outcome that you want, try the following instead:

In G2 just enter and copy down:

=SUMPRODUCT(SUMIFS($B$2:$B$9,$A$2:$A$9,$E2:$F2))
 
Upvote 0
Or this.....

In G2, copied down :

=VLOOKUP(IF(COUNTIF(A$2:A$9,E2),E2,F2),A$2:B$9,2,0)

Regards
Bosco
 
Last edited:
Upvote 0
Just curious: Does that give a different result from:

=LOOKUP(9.99999999999999E+307,SEARCH($A$2:$A$9,E2&"|"&F2),$B$2:$B$9)

which is proposed in post #5 ? If so, when?
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,215,507
Messages
6,125,212
Members
449,214
Latest member
mr_ordinaryboy

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