Return a value to a cell depending its range

Garjo

New Member
Joined
Jul 7, 2017
Messages
7
I'm hoping someone has the answer.

I Have a value within a cell to which I would like to check against a number of ranges and return a new value a shown below.

14 = 1


<tbody>
</tbody>


Less than 25 =


1
Between 25-75 =


2
Between 75-150 =


3
Between 150-250 =


4
Above 250 =


5

<tbody>
</tbody>

Which fuction should I be using within my formula
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
4,243
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
you can use a nested if() function like this, let say the value is in A1

-if(A1<25,1,if(A1<=75,2,if(A1<=150,3,if(A1<=250,4,5))))
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,970
Office Version
  1. 2016
Platform
  1. Windows
Assuming your values are never negative, you can also use this formula...

=LOOKUP(A1,{0,26,76,151,251},{1,2,3,4,5})
 

Garjo

New Member
Joined
Jul 7, 2017
Messages
7
Cheers Guys that works a treat the only issues im getting if the range is 0,1.11,1.12..... I always get a number 5 when using the lookup function
 

Garjo

New Member
Joined
Jul 7, 2017
Messages
7
Sorry my misstake i was pointing to the wrong cell. Thankyou for taking the time to help.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,390
Messages
5,636,041
Members
416,893
Latest member
Jomider

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
Top