Link to home
Start Free TrialLog in
Avatar of Frank Freese
Frank FreeseFlag for United States of America

asked on

Help understanding IFF(

Experts,
I'm trying to understand a query I've inherited that encompasses IFF( as seen below:

IIf([check amount] Between 60 And 80,9,IIf([check amount] Between 80 And 100,12,IIf([check amount] Between 100 And 120,15,IIf([check amount] Between 120 And 140,18,IIf([check amount] Between 140 And 160,21,IIf([check amount] Between 160 And 180,27,IIf([check amount] Between 180 And 200,30,IIf([check amount]>200,30,0)))))))) AS [held fee]

Can somebody please explain in English what's going on here?
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the first IIF
IIf([check amount] Between 60 And 80,9  
   * is testing the value of [Check AMount] is in the range of 60 to 80 and to return a value of 9

   * if the value is not satisfied by the first condition ( range of 60 to 80 ) it test the next
IIf([check amount] Between 80 And 100,12

and so on,

and if nothing in the IIF expression was satisfied , return a value of 0


*NOTE

you have an overlapping ranges of values

Between 60 And 80

Between 80 And 100


that should written like this

Between 60 And 79

Between 80 And 99

Between 100 And 119        

and so on


Avatar of Frank Freese

ASKER

thanks - I noticed the overlapping values - these developers just did such a poor job
Avatar of Norie
Norie

By the way, you could probably cut the expression down.

I tried a few things but the 'blip' from 21 to 27 throws it off.