Lookup formula - can handle descending ranges!? Solution anyone?

colman12

New Member
Joined
Jun 27, 2014
Messages
18
Hi,

Using a lookup formula to find where a value sits in a range.

i.e.

100 - 200 - "ABC" ---- 104 - Look up 104, between those ranges and return ABC - works fine

if the range is 200 ---- 100 - if NAs

Any solutions or can i use a different formula?

Thanks

Colin
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
If you can use exact match then the order of the data does not matter

where C2 has the value you are looking up. A2:B102 is your range to look in, looking in the 2nd column and, 0 for exact match
Code:
=VLOOKUP(C2,A2:B102,2,0)
 
Upvote 0
Hi Scott,

Thanks for helping.

I am not your approach is solving my issue.

I need to find where the lookup value sits within a range, hence why i am using a lookup.

I think a vlookup can only give me an exact match, not find which range the look up value sits within.

Is there is any way around this?

Let me know if am not being clear enough?
 
Upvote 0
Hi Scott,



I need to find where the lookup value sits within a range, hence why i am using a lookup.

I think a vlookup can only give me an exact match, not find which range the look up value sits within.

What do you mean exactly by "sits within a range"? The cell address?
 
Upvote 0
Provide some sample data in tabular format to show us what the spreadsheet looks like.

VLOOKUP has two closing arguments to choose from:

FALSE (or 0) gives an exact match
TRUE (or 1) gives an approximate match, but the lookup values must be in ascending order in the lookup column
 
Last edited:
Upvote 0
<style><!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";}.font5 {color:windowtext; font-size:8.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana; mso-generic-font-family:auto; mso-font-charset:0;}td {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana; mso-generic-font-family:auto; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;}.xl24 {text-align:center;}ruby {ruby-align:left;}rt {color:windowtext; font-size:8.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana; mso-generic-font-family:auto; mso-font-charset:0; mso-char-type:none; display:none;}--></style>Hi, sorry not really asked questions on here before, so unclear on the upload techniques.

The below example rows is what i am trying to achieve.

i have a value of 125, if it is ascending order, a lookup formula can tell me it sits in the range that will return the result "abc"

if that range is descending, the lookup formula can not produce same result, despite it still being true that 125 sits in the ABC range.

Hopefully that makes sense. Is there a way around this limitation on lookups?

ASCENDING RANGE LOOK UP
Range Range Look Up Value Return Value Formula
100200125 "ABC""ABC" =LOOKUP(D6,B:C,E:E)

<!--StartFragment--> <colgroup><col width="79"> <col width="39" span="2"> <col width="80"> <col width="73"> <col width="48"> <col width="11"> <col width="124"> </colgroup><tbody>
<!--EndFragment--></tbody>


<style><!--table {mso-displayed-decimal-separator:"\."; mso-displayed-thousand-separator:"\,";}.font5 {color:windowtext; font-size:8.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana; mso-generic-font-family:auto; mso-font-charset:0;}td {padding-top:1px; padding-right:1px; padding-left:1px; mso-ignore:padding; color:windowtext; font-size:10.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana; mso-generic-font-family:auto; mso-font-charset:0; mso-number-format:General; text-align:general; vertical-align:bottom; border:none; mso-background-source:auto; mso-pattern:auto; mso-protection:locked visible; white-space:nowrap; mso-rotate:0;}.xl24 {text-align:center;}ruby {ruby-align:left;}rt {color:windowtext; font-size:8.0pt; font-weight:400; font-style:normal; text-decoration:none; font-family:Verdana; mso-generic-font-family:auto; mso-font-charset:0; mso-char-type:none; display:none;}--></style>
Descending RANGE LOOK UP- doesnt work
RangeRangeLook Up ValueReturn ValueFormula
200200125"ABC"#N/A=LOOKUP(O5,M:N,P:P)

<!--StartFragment--> <colgroup><col width="75" span="7"> </colgroup><tbody>
<!--EndFragment--></tbody>
 
Upvote 0
What's the bigger picture here? There may be a solution, but as you are only giving us 'keyhole' views onto your data, it's hard to advise. Grab the ForumTools add-in for Excel (link in my sig line) and use that to post a larger sample of what's in your workbook. We've already confirmed that LOOKUP and VLOOKUP with an approximate match work only on ascending ranges.
 
Last edited:
Upvote 0
Hi all, thanks Ali, i will download the add in.

However, Tetra201 may have solved! I will try this tweak out and let you know if it works.

If not, I will post a proper excel example of what I am trying to achieve.
 
Upvote 0

Forum statistics

Threads
1,215,837
Messages
6,127,187
Members
449,368
Latest member
JayHo

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