if / then statement with range of greater than or equal to

bdschleich

Board Regular
Joined
Apr 26, 2005
Messages
133
What is the proper way to construct a formula for an if then statement in order to solve for a value (i.e. "x") that is in cell A1 meet the following criteria:

If X is greater than or equalt to 3.50 . . . then the answer is 1
If X is greater than or equal to 3.00 and less than 3.50 . . . then the answer is 2
If X is greater than or equal to 2.50 and less than 3.00 . . . then the answer is 3
If X is greater than or equal to 0.00 and less than 2.50 . . . then the answer is 4

Thanks!
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

jproffer

Well-known Member
Joined
Dec 15, 2004
Messages
2,643
Code:
=IF(A1>=3.5,1,IF(AND(A1>=3,A1<3.5),2,IF(AND(A1>=2.5,A1<3),3,IF(AND(A1>0,A1<2.5),4,"answer not in range"))))
 

gauntletxg

Well-known Member
Joined
Jul 15, 2008
Messages
636
=IF(A1>=3.5,1,IF(AND(A1>=3,A1<3.5),2,IF(AND(A1>=2.5,A1<3),3,IF(AND(A1>=0,A1<2.5),4,"Not found."))))

Or with a lookup table:

Excel Workbook
ABC
13.504
212.53
332
43.51
Sheet1
 

neeedhelp

New Member
Joined
Mar 12, 2008
Messages
10
I'm not sure I understand your question but I think you can use a nested IF function.

=IF(A1>=3.5,1,IF(A1>=3,2,IF(A1>=2.5,3,IF(A1>=0,4,""))))

If the contents of A1 are less than zero this will leave the cell you enter it into blank.
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
Actually, I've not seen any reason to use a nested lookup at all. A simple application of MATCH(___,___,-1) should do the trick:
  • =MATCH(A1+0.000000001,{99,3.5,3,2.5},-1)
<sup>edit</sup> Didn't see gauntlet's 2<sup>nd</sup> part... yup, VLookUp(___,___,true) would do the trick too. <sub>/edit</sub>
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,122,567
Messages
5,596,902
Members
414,110
Latest member
docops

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