Return string when value between 2 numbers

Twatwood

New Member
Joined
Nov 10, 2016
Messages
13
Office Version
  1. 365
Platform
  1. Windows
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]3.0
[/TD]
[TD]5.0[/TD]
[TD]HIGH
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]2.1
[/TD]
[TD]2.9
[/TD]
[TD]MODERATE
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]1.7
[/TD]
[TD]2.0
[/TD]
[TD]MEDIUM
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]0[/TD]
[TD]1.6[/TD]
[TD]LOW
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD][/TD]
[TD]2.2
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Return the appropriate string from column C where B6 is > column A and <= column B
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
See if this works for you.
This ia an array formula and must be entered with CTRL-SHIFT-ENTER.
Excel Workbook
ABC
135HIGH
22.12.9MODERATE
31.72MEDIUM
401.6LOW
5
62.2MODERATE
Sheet
 
Upvote 0
B6 is > column A and <= column B

Even if you round your numbers to the nearest 0.1, you're going to have gaps, e.g. is 1.7 LOW or MEDIUM?

I'm guessing that if you set your boundary conditions appropriately, a simple VLOOKUP or INDEX/MATCH will suffice, e.g. perhaps:

B8: =IFERROR(INDEX(B$1:B$5,MATCH(A8,A$1:A$5,-1)),"Too high!")


Excel 2010
AB
15.0HIGH
23.0MODERATE
32.1MEDIUM
41.7LOW
50.0Too Low!
6
7TestResult
80.000Too Low!
90.100LOW
101.600LOW
111.699LOW
121.700LOW
131.701MEDIUM
141.710MEDIUM
152.000MEDIUM
162.100MEDIUM
172.101MODERATE
182.900MODERATE
192.950MODERATE
203.000MODERATE
213.001HIGH
225.000HIGH
235.001Too high!
246.000Too high!
Sheet1
 
Last edited:
Upvote 0
If you sort column A from the OP ascending rather than descending, you could use a formula like

=LOOKUP(2.2, A1:A4, C1:C4)
 
Upvote 0
@Twatwood

If you sort the table in ascending order on column A, you can use a simple and very fast formula...

[TABLE="class: grid, width: 229"]
<tbody>[TR]
[TD]0[/TD]
[TD]1.6[/TD]
[TD]LOW[/TD]
[/TR]
[TR]
[TD]1.7[/TD]
[TD]2[/TD]
[TD]MEDIUM[/TD]
[/TR]
[TR]
[TD]2.1[/TD]
[TD]2.9[/TD]
[TD]MODERATE[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]5[/TD]
[TD]HIGH[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2.2[/TD]
[TD]MODERATE[/TD]
[/TR]
</tbody>[/TABLE]

In C6 just enter:

=LOOKUP(B6,$A$1:$C$4)
 
Upvote 0
Aladin, wouldn't the INDEX(..MATCH(...,-1)) require that it be sorted descending (as it is) rather than unsorted?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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