Nested IIf: Define ranges, >= And <=?

C

CanonMaiden

I'm trying to create a commission rate by defining several ranges based on
the Sale_Price field's value.
I am creating a calculated field in a query with the following syntax (for
lack of a BETTER word) ;)

Rate: IIf(([Sale_Price]>0 And [Sale_Price]<50,".30"),
IIf([Sale_Price]>=50 And [Sale_Price]<=299.99,".25"),
IIf([Sale_Price]>=300 And [Sale_Price]<=999.99,".20"),
IIf([Sale_Price]<=1000,".15","99"))))

I've tweaked this code every way I can think of, currently I'm receiving an
error that reads "The expression you entered contains a function with the
wrong number of arguments" I'm guessing that is a wordy way of telling me
unbalanced parentheses....
Thanks in advance to all the nice people out there who take the time to
answer our questions.
 
D

Dennis

Rate: IIf([Sale_Price]>0 And [Sale_Price]<50,".30",IIf([Sale_Price]>=50 And
[Sale_Price]<=299.99,".25",IIf([Sale_Price]>=300 And
[Sale_Price]<=999.99,".20",IIf([Sale_Price]<=1000,".15","99"))))
 
C

CanonMaiden

No fiar! I tried that, I swear!
Thanks, Dennis.

Dennis said:
Rate: IIf([Sale_Price]>0 And [Sale_Price]<50,".30",IIf([Sale_Price]>=50 And
[Sale_Price]<=299.99,".25",IIf([Sale_Price]>=300 And
[Sale_Price]<=999.99,".20",IIf([Sale_Price]<=1000,".15","99"))))

CanonMaiden said:
I'm trying to create a commission rate by defining several ranges based on
the Sale_Price field's value.
I am creating a calculated field in a query with the following syntax (for
lack of a BETTER word) ;)

Rate: IIf(([Sale_Price]>0 And [Sale_Price]<50,".30"),
IIf([Sale_Price]>=50 And [Sale_Price]<=299.99,".25"),
IIf([Sale_Price]>=300 And [Sale_Price]<=999.99,".20"),
IIf([Sale_Price]<=1000,".15","99"))))

I've tweaked this code every way I can think of, currently I'm receiving an
error that reads "The expression you entered contains a function with the
wrong number of arguments" I'm guessing that is a wordy way of telling me
unbalanced parentheses....
Thanks in advance to all the nice people out there who take the time to
answer our questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top