Disregarding the data type of Expr1, the poorly named field, if you restructure the IIF() function, it can be shortened considerably.
So here are your conditions:
Code:
if then
-------------------
>48 hrs > 5 Days
>36 hrs 4 Days
>24 hrs 3 Days
>12 hrs 2 Days
> 0 hrs < 1 day
If you structure the logic (conditions) to "fall through" from largest to smallest, you have fewer checks to make and the statement is simpler. For example, lets say that Expr1 = "24hrs 40mins".
check...
is Expr1 = "" No, then continue
is Expr1 = "> 48hrs 0mins" No, continue
is Expr1 = "> 36hrs 0mins" No, continue
is Expr1 = "> 24hrs 0mins" Yes, return "3 Days" and exit function
no need to check the remaining tests.
The IIF() statement would be: (I think I got the tests in the correct order )
Code:
Expr5: IIf([Expr1]="","",IIf([Expr1]>"48hrs 0min","> 5 Days",IIf([Expr1]>"36hrs 0min","4 Days",IIf([Expr1]>"24hrs 0min","3 Days",IIf([Expr1]>"12hrs 0min","2 Days","< 1 Day"))))))
Of course, the field type needs to be corrected......
Just something to think about. Or maybe I'm just bent a little strange....