How to use AND & OR in multiple If statements

I have the following Blood pressure categories and according to the category patient falls I should need to show the below messages

Systolic < 90 or Diastolic < 60; “Hypotension”;
Systolic ≤ 120 and Diastolic ≤ 80; “Normal”;
Systolic ≤ 140 and Diastolic ≤ 90; “Pre-hypertensive”;
Systolic ≤ 160 and Diastolic ≤ 100; “Hypertension Stg 1”;
Systolic ≤ 180 and Diastolic ≤ 110; “Hypertension Stg 2”;
Systolic ≥ 181 or Diastolic ≥ 111; “Hypertensive Crisis”;

Following is my expression, any alternative way to improve it further?

IFS(

([Systolic] >= 181),
(“Hypertensive Crisis”),
([Diastolic] >= 111),
(“Hypertensive Crisis”),

([Systolic] < 90),
(“Hypotension”),
([Diastolic] < 60),
(“Hypotension”),

([Systolic] <= 120),
(“Normal”),
([Diastolic] <= 80),
(“Normal”),

([Systolic] <= 140),
(“Pre-hypertensive”),
([Diastolic] <= 90),
(“Pre-hypertensive”),

([Systolic] <= 160),
(“Hypertension Stg 1”),
([Diastolic] <= 100),
(“Hypertension Stg 1”),

([Systolic] <= 180),
(“Hypertension Stg 2”),
([Diastolic] <= 110),
(“Hypertension Stg 2”)

)

@JAID

IFS(
	OR(
		Systolic < 90,
		Diastolic < 60
	),"Hypotension",
	AND(
		Systolic ≤ 120,
		Diastolic ≤ 80
	),"Normal",
	AND(
		Systolic ≤ 140,
		Diastolic ≤ 90
	),"Pre-hypertensive",
	AND(
		Systolic ≤ 160,
		Diastolic ≤ 100
	),"Hypertension Stg 1",
	AND(
		Systolic ≤ 180,
		Diastolic ≤ 110
	),"Hypertension Stg 2",
	OR(
		Systolic ≥ 181,
		Diastolic ≥ 111
	),"Hypertensive Crisis"
) 

1 Like

Thank you !!

@LeventK Thank you so much

@JAID you’re welcome

I have BMI data and based on BMI value I need to show the following messages.

underweight: <18.5
normal: 18.5-24.5
pre-obese: 25-29.9
obese class I: 30-34.99
obese class II: 35-39.99
obese class III: >40

With my below expression few IF conditions were not executing, could you please correct my mistake

IFS(

([BMI] > 40),
(“Obese Class III”),

([BMI] < 18.5),
(“Under Weight”),

([BMI] >= 18.5),
(“Normal”),

([BMI] >= 25),
(“Pre-obese”),

([BMI] < 29.9),
(“Pre-obese”),

([BMI] <= 24.5),
(“Normal”),

([BMI] >= 30),
(“Obese Class I”),

([BMI] < 34.99),
(“Obese Class I”),

([BMI] >= 35),
(“Obese Class II”),

([BMI] <= 40),
(“Obese Class II”)

)

@JAID
I believe you can do that with referencing to my previous post. It’s not that complicated.

3 Likes

@JAID
May be remind you as well, that IFS() expression strictly obeys to the order of the conditions specified within. The expression stops evaluating other conditions, once it evals one of the conditions to TRUE. Therefore I may advise structuring the IFS expression as logical and as wisely as possible as per your requirements.

2 Likes

@LeventK
Hi, I modified my IFS() expression order. Now its working fine.

1 Like