Evan Howlett
Evan Howlett

Reputation: 3

I keep getting an error from this equation

= IF(A5 =< 8, B5 * .07, IF(A5 > 8 AND A5 =< 15, B5 * .05, IF(A5 > 15 AND A5 < 20, B5 * .03, 00.00)))

I'm not exactly sure why I am receiving and error. The syntax looks correct, isn't it?

Upvotes: 0

Views: 25

Answers (2)

pnuts
pnuts

Reputation: 59475

It is shorter and perhaps easier to understand if the constant factor (B5) is extracted and applied to all results and the IF clauses are nested in such a way that they cascade effectively (ie don't use AND at all):

=B5*(IF(A5<=8,0.07,IF(A5<=15,0.05,IF(A5<20,0.03,0))))

Upvotes: 0

Marc
Marc

Reputation: 11613

You can't do an AND the way you're trying. You need to do it like this:

=IF(A5<=8,B5*0.07,IF(AND(A5>8,A5<=15),B5*0.05,IF(AND(A5>15,A5<20),B5*0.03,0)))

Upvotes: 1

Related Questions