Challenging IIF in query (1 Viewer)

ascaife

Registered User.
Local time
Tomorrow, 06:28
Joined
Nov 10, 2008
Messages
50
Any IIF wiz out there?

Fields are as follows:
AmountPaid
AmountCharged
Status


If [Status] = 201 or 202 and [AmountPaid] >=$500 or <$500 but >= 80% of [AmountCharged], then result is [AmountPaid] x 1.25, else result is [AmountPaid]

Challenging for me at least, I'm sure someone out there can whip this up in a few seconds.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 06:28
Joined
Jan 20, 2009
Messages
12,854
Try this, untested:

Code:
IIF(([Status]BETWEEN 201 AND 202) AND ([AmountPaid]>=500 OR ([AmountPaid]<500 AND [AmountPaid]>=[AmountCharged]*0.8)), [AmountPaid]*1.25,[AmountPaid])
 

ascaife

Registered User.
Local time
Tomorrow, 06:28
Joined
Nov 10, 2008
Messages
50
Thanks for the attempt, unfortunately no go on that one. Just comes up with #Error
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 06:28
Joined
Jan 20, 2009
Messages
12,854
If this is in a control add an equal sign at the beginning.
 

ascaife

Registered User.
Local time
Tomorrow, 06:28
Joined
Nov 10, 2008
Messages
50
Wow you seem to be handling all my queries today. Much appreciated.

No the statement is just in a query.
 

ascaife

Registered User.
Local time
Tomorrow, 06:28
Joined
Nov 10, 2008
Messages
50
Just sorted it. Seems I needed " " around 201 and 202
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 06:28
Joined
Jan 20, 2009
Messages
12,854
Just sorted it. Seems I needed " " around 201 and 202

Didn't realise the field with 201 and 202 was text. Good that you were able to work this out.

Just watch out using Between with text.
"201" is between "20" and "30"
 

Users who are viewing this thread

Top Bottom