Solved

Lookup Values Between 2 columns

Posted on 2011-09-15
8
214 Views
Last Modified: 2012-05-12
I need to look up a value that uses 2 different lookups. I need to look up the size in column J and see where it falls between the min & max in columns N & O using only rows 2-9 and only if the prod hours in column G are less than 40 and then give me the value in column P.

Then I need to look up up the Prod Hours in column G and if it's greater than 40 I need to see where it falls between the min & max in columns N & O but only using rows 10, 11, & 12 and then give me the value in column P.

The highlighted cells in the example file are what the value's should be based on the above descriptions.
Sample-File-R1.xls
0
Comment
Question by:Lawrence Salvucci
  • 3
  • 3
  • 2
8 Comments
 
LVL 39

Expert Comment

by:nutsch
ID: 36544964
=IF(G2<40,VLOOKUP(J2,$N$2:$P$9,3,1),VLOOKUP(J2,$N$10:$P$12,3,1))

Thomas
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 36545018
Insert in cell K2 and then copy down:
=IF(G2<=40,VLOOKUP(J2,$N$2:$P$9,3,TRUE),VLOOKUP(J2,$N$10:$P$12,3,TRUE))

You need the TRUE conditions to ensure that you are finding an approximate match in your sorted list.

Two more things:
1) you don't *need* the values in column O, as your list is sorted already
2) I recommend that you move your lookup list to another location so as not to interfere with your data range in columns A-L
0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36545030
That doesn't work. If the prod hours are >40 but does not fit in any of the ranges in cells N10:P12 then it needs to look up in cells N2:P9 to find the right work center.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 27

Expert Comment

by:Glenn Ray
ID: 36545081
You did not specify that in your original post.  Additionally, the formula provided by me produces the same results that were manually shown in column K.  Is that not correct?

0
 
LVL 39

Accepted Solution

by:
nutsch earned 500 total points
ID: 36545090
Can you reorg your data?

Having the table with Min  / Max / WOrk Center / WOrk Center >40 in cells N1:Q9

Min      Max      WC      WC >40
0.0050      0.0650      VS3      VS3
0.0651      0.1149      VS3      VS3
0.1150      0.1569      VS2      VS3
0.1570      0.1869      VS2      VS2
0.1870      0.2600      VS2      VS1
0.2601      0.5999      VS2      VS2
0.6000      0.9999      VS1      VS1
1.0000      4.0000      VS1      VS1

Using this formula then
=VLOOKUP(J2,$N$2:$Q$9,3+(G2>40),1)

Thomas

0
 
LVL 1

Author Closing Comment

by:Lawrence Salvucci
ID: 36545111
Thank you very much! It works perfectly!!!
0
 
LVL 39

Expert Comment

by:nutsch
ID: 36545409
Glad to help, thanks for the grade. One warning, if your size is greater than 4, the last line will still be returned, you'll have to modify the formula to return an error.



0
 
LVL 1

Author Comment

by:Lawrence Salvucci
ID: 36545426
Thanks Thomas. We'll never have a size greater than 4 so we should never run into that problem. But thanks for pointing it out.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
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…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

809 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