Vlookup with 2 criteria - should this be done via INDEX MATCH

M1donne

New Member
Joined
Apr 7, 2014
Messages
44
Hi all,

I hope all is well and lock-down is easing safely where you are.

It has been a while since I have posted so apologies if my format is a little rusty.

I have two tables and I want to extract a field from the 2nd table based on where two criteria are met (from the first table) - I tried using vLookup which doesn't have any criteria built in and then looked at using INDEX MATCH but I'm struggling to get the formula to work...

=INDEX(TABLE2!$H$2:$H$6232,AND(MATCH(A2,TABLE2!$A$2:$A$6232,0),MATCH(D2,TABLE2!$D$2:$D$6232,0)))

Where A2 and D2 are the Criteria in TABLE1 and the target field resides in TABLE2!$H$2:$H$6232

I don't know if this can be done via INDEX MATCH but if so, can you please point me in the direction of my error?

Much appreciated

MD
 

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 all,

I hope all is well and lock-down is easing safely where you are.

It has been a while since I have posted so apologies if my format is a little rusty.

I have two tables and I want to extract a field from the 2nd table based on where two criteria are met (from the first table) - I tried using vLookup which doesn't have any criteria built in and then looked at using INDEX MATCH but I'm struggling to get the formula to work...

=INDEX(TABLE2!$H$2:$H$6232,AND(MATCH(A2,TABLE2!$A$2:$A$6232,0),MATCH(D2,TABLE2!$D$2:$D$6232,0)))

Where A2 and D2 are the Criteria in TABLE1 and the target field resides in TABLE2!$H$2:$H$6232

I don't know if this can be done via INDEX MATCH but if so, can you please point me in the direction of my error?

Much appreciated

MD
Hi there,
use this formula
=vlookup(A2&" "&D2,choose({1,2},TABLE2!$A$2:$A$6232&" "&TABLE2!$D$2:$D$6232,TABLE2!$H$2:$H$6232 ),2,0)
since this is array formula hit CTRL+ SHIFT +ENTER to work.
 
Upvote 0
Another option
=INDEX(TABLE2!$H$2:$H$6232,MATCH(A2&"|"&H2,TABLE2!$A$2:$A$6232&"|"&TABLE2!$D$2:$D$6232,0))

Might need CSE entry.
 
Upvote 0
=INDEX(TABLE2!$H$2:$H$6232,MATCH(A2&"|"&H2,TABLE2!$A$2:$A$6232&"|"&TABLE2!$D$2:$D$6232,0)) didn't work (even as array formula), can I ask what the | is for?
 
Upvote 0
It's just a separator, to keep the cell values distinct.
 
Upvote 0
=vlookup(A2&" "&D2,choose({1,2},TABLE2!$A$2:$A$6232&" "&TABLE2!$D$2:$D$6232,TABLE2!$H$2:$H$6232 ),2,0) no luck either sadly.
 
Upvote 0
Just realised there's a typo on mine, it should be
=INDEX(TABLE2!$H$2:$H$6232,MATCH(A2&"|"&D2,TABLE2!$A$2:$A$6232&"|"&TABLE2!$D$2:$D$6232,0))
 
Upvote 0
=vlookup(A2&" "&D2,choose({1,2},TABLE2!$A$2:$A$6232&" "&TABLE2!$D$2:$D$6232,TABLE2!$H$2:$H$6232 ),2,0) no luck either sadly.
hey,
its space between double quotes and did you use ctrl +shift +enter. i think it should be working .you can display your screenshot of the errors formore clarity of your query.
 
Upvote 0
Thanks all, massively appreciated, in the end I defaulted to my Getpivotdata based on 2 criteria, not as pretty but very effective.

Thanks again.
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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