Using if and or

dneas

New Member
Joined
Mar 3, 2002
Messages
34
F2=104 but I cannot get this to work? =IF(F2<73,"Class I",IF(F2>73<100,"Class II",IF(F2>100<200,"Class III")))
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
On 2002-03-11 12:20, dneas wrote:
F2=104 but I cannot get this to work? =IF(F2<73,"Class I",IF(F2>73<100,"Class II",IF(F2>100<200,"Class III")))

Try this:

=IF(F2<73,"Class I",IF(F2<100,"Class II",IF(F2<200,"Class III")))

Hope this helps,

Russell
This message was edited by Russell Hauf on 2002-03-11 12:27
This message was edited by Russell Hauf on 2002-03-11 12:27
 
Upvote 0
On 2002-03-11 12:20, dneas wrote:
F2=104 but I cannot get this to work? =IF(F2<73,"Class I",IF(F2>73<100,"Class II",IF(F2>100<200,"Class III")))

=IF(F2<73,"Class I",IF(F2<100,"Class II",IF(F2<200,"Class III","?")))

This will classify F2=0 as Class I. If that's not desired, use

or

=IF(F2,IF(F2<73,"Class I",IF(F2<100,"Class II",IF(F2<200,"Class III","?"))),"")

Both formulas will produce a question mark if F2 >= 200.
This message was edited by Aladin Akyurek on 2002-03-11 13:02
 
Upvote 0
On 2002-03-11 12:20, dneas wrote:
F2=104 but I cannot get this to work? =IF(F2<73,"Class I",IF(F2>73<100,"Class II",IF(F2>100<200,"Class III")))

try this formula
=iF(F2<73,"Class I",IF(F2<100,"Class II",IF(F2<200,"Class III")))
 
Upvote 0
On 2002-03-11 12:20, dneas wrote:
F2=104 but I cannot get this to work? =IF(F2<73,"Class I",IF(F2>73<100,"Class II",IF(F2>100<200,"Class III")))

Also nice to have:

=IF(F2>0,VLOOKUP(F2,{0,"Class I";73,"Class II";100,"Class III";200,"?"},2),"")
 
Upvote 0
Anonymous - if the number is 200 it returns Class II because it is greater than 100. I think you need the OR or AND included.
This message was edited by dneas on 2002-03-11 12:55
 
Upvote 0
On 2002-03-11 12:54, dneas wrote:
Anonymous - if the number is 200 it returns Class II because it is greater than 100. I think you need the OR or AND included.
This message was edited by dneas on 2002-03-11 12:55

Try also both formulas I proposed. If the input is 200, both return a question mark. You can replace ? with something that is more suitable.
 
Upvote 0
On 2002-03-11 12:32, Anonymous wrote:
On 2002-03-11 12:20, dneas wrote:
F2=104 but I cannot get this to work? =IF(F2<73,"Class I",IF(F2>73<100,"Class II",IF(F2>100<200,"Class III")))

try this formula
=iF(F2<73,"Class I",IF(F2<100,"Class II",IF(F2<200,"Class III")))

On 2002-03-11 12:54, dneas wrote:
Anonymous - if the number is 200 it returns Class II because it is greater than 100. I think you need the OR or AND included.
This message was edited by dneas on 2002-03-11 12:55

dneas, if you want Class II returned for the number 200, change the< to a<=:
=iF(F2<73,"Class I",IF(F2<100,"Class II",IF(F2<=200,"Class III"))).

If statements are progressive, meaning it first checks if F2 is less than 73, if not, it then checks if F2 is less than 100, but it already knows its greater than 73 because this was already checked. It then checks if F2 is less than or equal to 200, knowing that it is greater than 200. You should also think about putting another else at the end, in the case that F2 is greater than 200.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

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