Index and Match HELP!!

mercmannick

Well-known Member
Joined
Jan 21, 2005
Messages
730
hi

can anyone see why this Formula wont work ?

Code:
=INDEX(LOOKUP!A5:A31847,MATCH(B7,LOOKUP!A5:A31847,0),MATCH(F7,LOOKUP!A5:D31847,0),MATCH(A4,LOOKUP!D4:D31846,0))
Cell E Worklist - week 21.xls
ABCDEFGHIJKL
4L70S03EL70MaterialS/S
5PriorityMaterialPONUMStartFinishPhaseqtyStatGMPSLOCATIONPromDateLocate
61D321530300060110260909404.05.0605.05.063002P0L70L70H11H81A30A04#N/A#N/A
72D321530300060110260909405.05.0606.05.063502S0L70L70H11H81A30A04#N/A#N/A
83D321560050040110261734009.05.0610.05.063501P0L70L70H11H81A30A04#N/A
94F321550210000110191318210.05.0611.05.062502GMPSA30L70L70A30HT1L70L70H11H87A30H81#N/A
105D321560050040110261734010.05.0611.05.064001S0L70L70H11H81A30A04#N/A
116F321550210000110191318211.05.0612.05.063002GMPSA30L70L70A30HT1L70L70H11H87A30H81#N/A
L70





trying to get the value from matches of

IF A4 , B6, and F6 Match Sheet below then give me value from below Sheet Col C
Cell E Worklist - week 21.xls
ABCD
1
2hours
3partnumberPhaseperbatchM/c
4D275500170051005.10M88
5D275500170051505.70M88
6D275500170052002.27M88
7D275500170052004.53M88
8D275500170052504.75M88
9D275500170051005.10M85
10D275500170051505.70M85
11D275500170052002.27M85
12D32153030006013006.40L70
13D321530300060130030.40L70
14D321530300060130028.00L70
LOOKUP


they must all match on the same line in lookup sheet

Many Thanks

Merc
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
=INDEX(LOOKUP!$C$4:$C$14,MATCH(1,IF(LOOKUP!$D$4:$D$14=$A$4,IF(LOOKUP!$A$4:$A$14=B6,IF(LOOKUP!$B$4:$B$14=F6,1))),0))

which must be confirmed with control+shift+enter (not just with enter) and copied down.
 
Upvote 0
Aladin

Amazing thnx m8

Can you break down your Formula so i can understand and learn from it

Also can i put isna or iserror to not show non matches as #N/A's

Merc
 
Upvote 0
Aladin

Amazing thnx m8

Can you break down your Formula so i can understand and learn from it

Also can i put isna or iserror to not show non matches as #N/A's

Merc

Code:
=INDEX(LOOKUP!$C$4:$C$14,
       MATCH(1,
             IF(LOOKUP!$D$4:$D$14=$A$4,
                IF(LOOKUP!$A$4:$A$14=B6,
                   IF(LOOKUP!$B$4:$B$14=F6,1))),0))

INDEX is given a return range: C4:C14 and needs a position value.

The MATCH bit calculates the needed position from a calculated match range, based on multiple conditions:

Evaluate if D-cells are equal to A4. If so,
evaluate if corresponding A-cells are equal to B6, If so:
evaluate if corresponding cells are equal to F6. If so, return 1 otherwise FALSE.

Thus the IF bits taken together returns something like:

{FALSE;1;FALSE;FALSE;1}

MATCH(1,{FALSE;1;FALSE;FALSE;1},0)

returns 2 for the first 1 is at position 2 in {FALSE;1;FALSE;FALSE;1}.

INDEX, with 2 handed to it, returns the value at position 2 in the return range, yielding the desired result.

A set of FALSE evaluations would make MATCH fail, hence #N/A.

If you have the morefunc.xll add-in installed, you'd have the most efficent way of avoiding #N/A...

Code:
=IF(ISNUMBER(SETV(MATCH(1,
             IF(LOOKUP!$D$4:$D$14=$A$4,
                IF(LOOKUP!$A$4:$A$14=B6,
                   IF(LOOKUP!$B$4:$B$14=F6,1))),0))),
      INDEX(LOOKUP!$C$4:$C$14,GETV()),
      "")

confirmed of course with control+shift+enter.

Otherwise use a 2-cell approach:

Y2:

Code:
=MATCH(1,
       IF(LOOKUP!$D$4:$D$14=$A$4,
          IF(LOOKUP!$A$4:$A$14=B6,
             IF(LOOKUP!$B$4:$B$14=F6,1))),0)

confirmed with control+shift+enter.

Y2:

=IF(ISNUMBER(X2),INDEX(LOOKUP!$C$4:$C$14,X2),"")

which just needs enter.


The next version of Excel seems to introduce IFERROR, which allows one to construct:

Code:
=IFERROR(INDEX(LOOKUP!$C$4:$C$14,
       MATCH(1,
             IF(LOOKUP!$D$4:$D$14=$A$4,
                IF(LOOKUP!$A$4:$A$14=B6,
                   IF(LOOKUP!$B$4:$B$14=F6,1))),0)),"")
 
Upvote 0
superb thnx Aladin

cant work out how it works fine on 1 sheet , try it on another sheet exactly the same layout and it fails

Any idea where i am going wrong ?

Merc
 
Upvote 0
superb thnx Aladin

cant work out how it works fine on 1 sheet , try it on another sheet exactly the same layout and it fails

Any idea where i am going wrong ?

Merc

What formula did you implement on the other sheet where it fails? BTW, what result did you get that you qualify as failure?
 
Upvote 0
Aladin i used your formula on other sheets , and it returns #N/A

but i have done a manual check and it should return the values as lookup sheet contains them

(yet on first sheet it works perfectly)


Merc
 
Upvote 0
Aladin i used your formula on other sheets , and it returns #N/A

but i have done a manual check and it should return the values as lookup sheet contains them

(yet on first sheet it works perfectly)


Merc

Hope you didn't forget control+shift+enter...
 
Upvote 0
No Aladin same on first heet as in other 4 sheets, what i cant work out is how can it work on sheet 1 and not on other 4 sheets ?

Merc
 
Upvote 0
No Aladin same on first heet as in other 4 sheets, what i cant work out is how can it work on sheet 1 and not on other 4 sheets ?

Merc

You still didn't say what results you get...

A possible reason can be that you have unwanted chars around the relevant entries like spaces. You could try to clean up the data with the TrimAll macro whose is available in some of the threads on this board.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,692
Members
449,117
Latest member
Aaagu

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