Nested if statement?

J

Jim Dixon

I've got to apply a proportional tax to gasoline, $.0012 per gallon starting
April 1. Easy so far, but it's according to how much petroleum is in the
product, which causes no problems until you get to what is called E-85...85%
alcohol, and 15% gasoline, depending on the month of the year (also on the
state selling it, but let's not go there, yet).

Basically, the product is 25% gas from October to March, 20% gas in April &
May, and August & September, and 15% gas in June and July.

Anyone have any ideas? I can just wrap my head around an IF..THEN
statement, but when you nest them I start getting dizzy, it must be my
wife's blonde hair affecting me.

Thanks
 
G

Glen Mettler

Instead of and IF you might consider a Case statement - might make it more
manageable

Glen
 
S

Sandy Mann

Jim,

There may be better ways but with the date in B2 and the amount in G2 try:

=(15%+(MONTH(B2)<6)*5%+((MONTH(B2)<4)+(MONTH(B2)>7)*2)*5%)*G2

--
HTH

Sandy
(e-mail address removed)
(e-mail address removed) with @tiscali.co.uk
 
H

Harlan Grove

Sandy Mann wrote...
There may be better ways but with the date in B2 and the amount in G2 try:

=(15%+(MONTH(B2)<6)*5%+((MONTH(B2)<4)+(MONTH(B2)>7)*2)*5%)*G2
....

More structured perhaps,

=LOOKUP(ABS(MONTH(B2)-6.5),{0.5;1.5;3.5},{0.15;0.2;0.25})*G2
 

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