mileage calc

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
667
Office Version
  1. 365
Platform
  1. Windows
Hi,

Have tried & tried to sort this myself, but cannot & hoping Mr excel can provide the answer?

I am tryin to create a expenses calculation for mileage . But its not stright forward ( well for me that is).

For example, the total milage from start post code to end post code = 205miles.

I have to knock off the 1st 30 miles =175
The company allows 0.40 between 1 - 75miles = 75 x 0.40=£30
The comapny allows 0.20 for anything over 75 miles = 100 x 0.20 =£20

My issues are:-
I need to have something that when the total mileage meets the above , but also when the total mileage does not
For example, the total milage from start post code to end post code = 50 miles,

knock off the 1st 30 miles =20
The company allows 0.40 between 1 - 75miles =20 x 0.40 = £8

Also, as I will doing multi rows, if A2 ,a3, a4 etc is blank, than all the retrospective cells in that applicable row will be blank too ( just to keep things tidy)

I have treid to do this all on one row , so all I have to do is enter the total milage from start post code to end post code in A2..

Hoping this makes sense & thank you for helping me & taking up my issue.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
How about
+Fluff 1.xlsm
AB
1
220550
3508
4200
5 
6
Master
Cell Formulas
RangeFormula
B2:B5B2=IF(A2="","",IF(A2<30,0,(A2-30)*0.4-(MAX(0,A2-105)*0.2)))
 
Upvote 0
See if this works
Excel Formula:
=SUMPRODUCT((A2>{0,30,105})*(A2-{0,30,105})*{0,0.4,-0.2})
 
Upvote 0
Excel Formula:
=MEDIAN(75,A1-30,0)*0.4 +MAX(A1-105,0)*0.2

Excel Formula:
=LET(Miles,A1,MEDIAN(75,Miles-30,0)*0.4 +MAX(Miles-105,0)*0.2)
 
Upvote 0
How about
+Fluff 1.xlsm
AB
1
220550
3508
4200
5 
6
Master
Cell Formulas
RangeFormula
B2:B5B2=IF(A2="","",IF(A2<30,0,(A2-30)*0.4-(MAX(0,A2-105)*0.2)))

How about
+Fluff 1.xlsm
AB
1
220550
3508
4200
5 
6
Master
Cell Formulas
RangeFormula
B2:B5B2=IF(A2="","",IF(A2<30,0,(A2-30)*0.4-(MAX(0,A2-105)*0.2)))
Hi Fluff
thanks for your help.....


Start PC-End PC Mileage-301 -75 @0.40p75> @0.20Total Repaid
200170


I think I must of not made myself clear... So sorry but I need it to look like the above .
 
Upvote 0
Excel Formula:
=MEDIAN(75,A1-30,0)*0.4 +MAX(A1-105,0)*0.2

Excel Formula:
=LET(Miles,A1,MEDIAN(75,Miles-30,0)*0.4 +MAX(Miles-105,0)*0.2)
Hi

thank you for your reply.

Start PC-End PC Mileage-301 -75 @0.40p75> @0.20Total Repaid
200170



I think I must of not made myself clear... So sorry but I need it to look like the above
 
Upvote 0
See if this works
Excel Formula:
=SUMPRODUCT((A2>{0,30,105})*(A2-{0,30,105})*{0,0.4,-0.2})
hi & thanks for your help.

Book1
ABCDE
1Start PC-End PC Mileage-301 -75 @0.40p75> @0.20Total Repaid
2200170
3
4 
5 
6 
Sheet1
Cell Formulas
RangeFormula
B2B2=A2-30
B4:B6B4=IF(A4="","",IF(A4<30,0,(A4-30)*0.4-(MAX(0,A4-105)*0.2)))




I think I must of not made myself clear... So sorry but I need it to look like the above .
 
Upvote 0
How about
+Fluff 1.xlsm
ABCDE
1Start PC-End PC Mileage-301 -75 @0.40p75> @0.20Total Repaid
2200170301949
3    
4    
Lists
Cell Formulas
RangeFormula
B2:B4B2=IF(A2="","",A2-30)
C2:C4C2=IF(A2="","",MAX(0,MIN(B2,75))*0.4)
D2:D4D2=IF(A2="","",MAX(B2-75,0)*0.2)
E2:E4E2=IF(A2="","",SUM(C2:D2))
 
Upvote 0
Solution

Book1
ABCDE
1Start PC-End PC Mileage-301 -75 @0.40p75> @0.20Total Repaid
2200170301949
Sheet1
Cell Formulas
RangeFormula
B2B2=MIN(A2-30)
C2C2=MEDIAN(75,A2-30,0)*0.4
D2D2=MAX(A2-105,0)*0.2
E2E2=MEDIAN(75,A2-30,0)*0.4 +MAX(A2-105,0)*0.2
 
Upvote 0

Forum statistics

Threads
1,215,053
Messages
6,122,888
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top