Caculated Field Expression not working (1 Viewer)

Mackbear

Registered User.
Local time
Today, 17:54
Joined
Apr 2, 2019
Messages
168
Hello, good day! Reaching out again for help. I can't seem to make this expression work properly. What I need is if the value of the field is:

<-2 "Emergency"
-1 or 0 "Critical"
1 "High"
2 or 3 "Medium"
>3 "Low"

The expression I have is:
IIf([Age]<=-2,"Emergency",IIf([Age]=-1<=0,"Critical",IIf([Age]=1,"High",IIf([Age]>=2<=3,"Medium",IIf([Age]>3,"Low","No Date")))))

The results only show emergency and critical even with values 1 and above.

What am I missing here?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:54
Joined
Oct 29, 2018
Messages
21,454
Hi. When you have two criteria to apply against the same field, you'll have to check each one. For example:
Code:
IIf([Age]=-1 OR [Age]=0,...
You could try it this way:
Code:
IIf([Age]<=-1,"Emergency",IIf([Age]<=0,"Critical",IIf([Age]=1,"High",IIf([Age]<=3,"Medium","High"))))
(untested)
Hope it helps...
 

Cronk

Registered User.
Local time
Tomorrow, 08:54
Joined
Jul 4, 2013
Messages
2,771
Code:
IIf([Age]<=-2,"Emergency",IIf([Age]=-[B][COLOR=Red]1<=0[/COLOR][/B],"Critical",IIf([Age]=1,"High",IIf([Age]>[B][COLOR=red]=2<=3[/COLOR][/B],"Medium",IIf([Age]>3,"Low","No  Date")))))


The problem is with the bits in red. They will give a true value. Change line to

Code:
IIf([Age]<=-2,"Emergency",IIf([Age]<=0,"Critical",IIf([Age]=1,"High",IIf([Age]<=3,"Medium",IIf([Age]>3,"Low","No  Date")))))
 

Mackbear

Registered User.
Local time
Today, 17:54
Joined
Apr 2, 2019
Messages
168
I thank you everyone for the help! :):):) It is working now. You guys are great!
 

Users who are viewing this thread

Top Bottom