Help with IF OR formula

emmadisa

New Member
Joined
Jul 9, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I can't seem to resolve, would appreciate any help.

I'm looking to find a value between number ranges in a single cell. <=40, >=40 <=60, >=60 <=80, >=100. The for each result return TEXT: <=40 "Low", >=40 <=60 "MEDIUM", >=60 <=80 "HIGH", >=100 "CRITICAL"

current formula that's not working target cell is C3:

=IF(OR(C3<40,), "LOW", IF(OR(C3>=40,C3<=60),"MEDIUM", IF(OR(C3>=60, C3<=80), "HIGH", IF(OR(C3>=80,),"CRITICAL", ""))))
 

Attachments

  • Capture.JPG
    Capture.JPG
    52.6 KB · Views: 3

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
To do it they way you are doing it you need AND not OR.
You have some inconsistencies in you logic though.
• You are using both >= and <= so do you want 60 to be Medium or High based on Low being < 40 I have assumed that will apply to all.
• You have a gap from 80 - 100 where it is above high and below critical, what category is this.

You would normally use something like this and rely on the fact that IF works from left to right.
Excel Formula:
=IF(C3<40, "LOW", IF(C3<60,"MEDIUM", IF(C3<80, "HIGH", "CRITICAL")))
 
Upvote 0
Solution
Edit:
What Alex said.

To avoid the nested IF, the other typical approach is to do a lookup.
Excel Formula:
=XLOOKUP(C3,{0,40,60,80},{"LOW","MEDIUM","HIGH","CRITICAL"},,-1)
 
Upvote 0
Thanks Alex. C3 receives a numeric score from another calculation. The score is related to the items criticality, is a number between 0-100. I want to calculate a text output based on the range:

Low = Lower than 40.
Medium = Equal to and higher than 40, equal to or lower than 60.
High = Equal to and higher than 61, equal to or lower than 80
Critical = equal to and Higher than 81

Regards,

Tony

=IF(C3<40, "LOW", IF(C3<60,"MEDIUM", IF(C3<80, "HIGH", "CRITICAL")))
 
Upvote 0
I personally think that's inconsistent and would change the 40 threshold to 41 as well but this does what you said:
VBA Code:
=IF(C3<40, "LOW", IF(C3<61,"MEDIUM", IF(C3<81, "HIGH", "CRITICAL")))

For Cubist formula follow the same logic.
 
Upvote 0
Since your intervals are increments of 20's you can try this as well:
Excel Formula:
=CHOOSE(MAX(C3/20,1),"LOW","MEDIUM","HIGH","CRITICAL","CRITICAL")
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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