?
Solved

Index & Match Formula

Posted on 2011-09-22
13
Medium Priority
?
215 Views
Last Modified: 2012-05-12
I'm trying to create a matrix where I can look up a value based on length of parts, diameter, and production hours. I've attached a sample of what I'm looking to do.

Columns M, N, & O are the variables I need to look up in the grid to the left. I need to find the match and then put that in column P.

I entered the first one in column P as an example.
Book2.xlsx
0
Comment
Question by:Lawrence Salvucci
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 36584382
Ideally for this to work in the standard manner you need to reverse the order of the table in respect of G3:K3

I put in a new table in E16:K23 then you can use this formula in P2 copied down

=IF(N2>40,INDEX(G$22:K$23,MATCH(O2,E$22:E$23),MATCH(M2,G$16:K$16)),INDEX(G$17:K$20,MATCH(O2,E$17:E$20),MATCH(M2,G$16:K$16)))

You get #N/A error in P13 because size doesn't fall in any of the ranges

see attached

regards, barry
27323353.xlsx
0
 
LVL 12

Expert Comment

by:kgerb
ID: 36584399
For a lookup like this you should really normalize your data.  You should have columns hours, min dia, max dia, min length, max length, and work center.  That's your "database".  At that point it becomes much easier to do multiple criteria searches on your data.  You can use a pivot table at that point too.  Do some googling for sumproduct lookups and you'll find a wealth if info.

Kyle
0
 
LVL 81

Expert Comment

by:byundt
ID: 36584459
You need to watch out for pieces that are too thin or too thick for the limits in the table. The suggested formula handles the minimum constraint, but not the maximum. It needs another two rows of data in the lookup table for that feature.

Using VLOOKUP and MATCH, here is an alternative approach. You will need to refer to the sample workbook to understand the cell range references.
=IF(N2<40,VLOOKUP(O2,E$3:K$8,MATCH(M2,G$2:K$2)+2),VLOOKUP(O2,E$10:K$13,MATCH(M2,G$2:K$2)+2))

Book2Q27323353.xlsx
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36584464
@barryhoudini

I made a mistake on my sample file. If the production hours are greater than 40 but not in those 2 size ranges then it needs to look at the other 4 ranges and find the work center. The top 4 ranges should not be less than 40 hours. Those 4 ranges are for any amount of hours and only if the hours are greater than 40 and within those 2 ranges at the bottom should it look for the work center there. I hope this makes sense. I attached a new sample file with your formulas.
Sample-File.xls
0
 
LVL 81

Accepted Solution

by:
byundt earned 2000 total points
ID: 36584631
Using the latest sample workbook, you might use a formula like:
=INDEX(G$17:K$23,IF(AND(N2>40,O2<F$23),MATCH(O2,E$22:E$23),MATCH(O2,E$17:E$20)),MATCH(M2,G$16:K$16))

I added a row for greater than 3" thickness
Sample-FileQ27323353.xls
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36585939
Thank you for the help. You have 2 formulas in your sample file, one in column P and one in Q. Which is the correct one?
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36585993
I don't believe it's working properly with either of those formulas. If you look at the one I highlighted in orange you will see why.
Copy-of-Sample-File.xls
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36586054
I figured it out. Here's the formula that I modified to fix the problem in my previous post:

INDEX(G$17:K$23,IF(AND(N13>40,O13<F$23,>E$22),MATCH(O13,E$22:E$23),MATCH(O13,E$17:E$20)),MATCH(M13,G$16:K$16))
0
 
LVL 1

Author Closing Comment

by:Lawrence Salvucci
ID: 36586057
Thank you very much for your help!
0
 
LVL 81

Expert Comment

by:byundt
ID: 36586325
For your problem situation, I needed to check the minimum thickness condition as well. I therefore suggest this revised formula:
=INDEX(G$17:K$23,IF(AND(N2>40,O2<=F$23,O2>=E$22),MATCH(O2,E$22:E$23)+5,MATCH(O2,E$17:E$20)),MATCH(M2,G$16:K$16))

The +5 in this formula shifts to the bottom part of the table, and I mistakenly left it out of my previously suggested formula. It is necessary, as you can see with inputs 67, 44 and .0625 (original formula returned 2051 but should have returned 2053-1).
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36586362
Can post the example file again so I can see what you mean?
0
 
LVL 81

Expert Comment

by:byundt
ID: 36586401
Look at column R and row 15 in the sample file.
Sample-FileQ27323353.xls
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36586565
Got it, thank you. I understand your formula now. Thanks again...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question