View Single Post
  #2   Report Post  
HiArt
 
Posts: n/a
Default


Hi rsikin,

in the Mileage column you need to add the following formula:

Code:
--------------------
=IF(F7-C7<1,IF(G7<=125,G7*0.485,60.625+(0.15*(G7-125))),IF(AND(F7-C7=1,F7-C7<2),IF(G7<=250,G7*0.485,121.25+(0.15*(G7-250))),IF(AND(F7-C7=2,F7-C7<3),IF(G7<=375,G7*0.485,181.88+(0.15*(G7-375))),IF(AND(F7-C7=3,F7-C7<4),IF(G7<=500,G7*0.485,242.5+(0.15*(G7-500))),IF(AND(F7-C7=4,F7-C7<5),IF(G7<=625,G7*0.485,303.13+(0.15*(G7-625))),"Error")))))
--------------------


This is a bit less daunting if you break this down:

Code:
--------------------
=IF( F5-C5<1 ,IF(G5<=125,G5*0.485,60.625+(0.15*(G5-125))),
IF(AND(F5-C5=1,F5-C5<2),IF(G5<=250,G5*0.485,121.25+(0.15*(G5-250))),
IF(AND(F5-C5=2,F5-C5<3),IF(G5<=375,G5*0.485,181.88+(0.15*(G5-375))),
IF(AND(F5-C5=3,F5-C5<4),IF(G5<=500,G5*0.485,242.50+(0.15*(G5-500))),
IF(AND(F5-C5=4,F5-C5<5),IF(G5<=625,G5*0.485,303.13+(0.15*(G5-625))),"Error")))))
--------------------


Now you can see that there is an IF statement for each scenario.

The first IF determines the number of days out of office followed by
another IF to calculate the expenses using the requirements you
provided.

Lastly, "Error" is there in case the number of days exceeds 5.

HTH

Art


--
HiArt
------------------------------------------------------------------------
HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953
View this thread: http://www.excelforum.com/showthread...hreadid=472013