Multiple if statements in one expression?

I am trying to put together an expression that looks at several different possible values:

What i want:
If Speed > 70 then = Speed - 30
If Speed is lower than 70 but higher than 30 then = Speed -15
If Speed lower than 30 then = Speed

I put this as my expression which i know is wrong but i cannot figure it out:

IF([Speed] > 70, [Speed] - 30, [Speed]), AND IF([Speed] < 70, [Speed] - 15, [Speed])

Solved Solved
0 9 3,610
1 ACCEPTED SOLUTION

If it works, itโ€™s correct!

You could also use IFS():

IFS(
 ([Speed] > 70),
   ([Speed] - 30),
 ([Speed] > 30),
   ([Speed] - 15),
 TRUE,
   [Speed]
)

View solution in original post

9 REPLIES 9

You need to do a nested IF:

IF(
   [Speed] > 70 , [Speed] - 30,
   IF(
      [Speed] < 30 , [Speed] , 
      [Speed] - 15
      )
)

There is a SWITCH() function for simplifying nested IF functions. Unfortunately I donโ€™t think it can check for equivalencies such as greater or less thans yet, so the above nested IF() is the best solution.

@Steve is this correct?

That worked!

Thanks

If it works, itโ€™s correct!

You could also use IFS():

IFS(
 ([Speed] > 70),
   ([Speed] - 30),
 ([Speed] > 30),
   ([Speed] - 15),
 TRUE,
   [Speed]
)

It works but i am noticing if the speed is over 100 it get a little farther off. So how do i add:

If Speed is over 100 then = Speed - 40

nm. I followed your lead. Got it! Thanks

JAID
New Member

I want to display message based on Blood Sugar level but in the below expression few if conditions are not executing. please correct me if I am doing mistake
IFS(
([Blood Sugar] <= 130),
(โ€œNormalโ€),
([Blood Sugar] > 130),
(โ€œLow Riskโ€),
([Blood Sugar] > 175),
(โ€œLevel 1โ€),
([Blood Sugar] > 299),
(โ€œLevel 2โ€),
([Blood Sugar] > 400),
(โ€œLevel 3โ€),
TRUE,
[Blood Sugar]
)

Level 1 Level 2 Level 3 messages are not displaying

Try this:

IFS(
	[Blood Sugar] > 400, "Level 3",
	[Blood Sugar] > 299, "Level 2",
	[Blood Sugar] > 175, "Level 1",
	[Blood Sugar] > 130, "Low Risk",
	TRUE,"Normal"
)

Thank you!

Top Labels in this Space