Calculating Transportation Cost with certain range of miles

Mahfuzah90

New Member
Joined
Oct 12, 2016
Messages
3
Hello guys, can anyone help me to create a formula for 2 situation as below:

SITUATION 1

KM = Kilometres
RM = currency
Total KM = 943KM (Assumption Cell = A2) , Total Cost = RM??
First 500KMX RM0.70
Next 500KMX RM0.65

<tbody>
</tbody>

Formula i used in excel:
=A2*0.65+MIN(A2,500)*0.05
=RM637.95
*it's correct formula???,

SITUATION 2

KM = Kilometres
RM = currency

Total KM = 943KM (Assumption Cell = A2), Total Cost = RM??
First 50 KMRM150.00
Next 200KMx RM3.00
Next 250KMx RM2.25
Next 250KMx RM1.50
Next 250KMx RM1.13
Next 250KMx RM0.75

<tbody>
</tbody>


Or if you have other formula that more easier than this? kindly share with me.
Thank you in advance.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi Mahfuzah90,

Are the values in the cells entered just as numeric values (as in, for Situation 1, Cell A3 has the value 500 or literally the text "First 500KM")? The same question applies to the second column, as well. Also, are your values likely to change over time or are we safe to hardcode them?

For example, here are two solutions for Situation 1:
=IF(A2<=500,A2*0.7,(500*0.7)+((A2-500)*0.65)) , for cases where the values will never change and / or there is text in the column, not numeric values
=IF(A2<=A3,A2*B3,(A3*B3)+((A2-A3)*B3)) , for cases where the values entered are numeric and may change over time.

Depending on your answer I can provide the solution for situation 2 accordingly.

Cheers,
Catalin
 
Upvote 0
Thanks for the feedback,

I already try the formula that u give for Situation 1, and it's worked. TQ

For the situation 2, I attach the table for more understanding.

30164937552_6cc7335125_b.jpg


Sorry for trouble. TQ for ur time
 
Upvote 0
Hi Mahfuzah90,

By the looks of your spreadsheet you're using the hardcoded formulas. Here is the one for Situation 2:

=IF(F30<51,150,IF(F30<251,150+(F30-50)*3,IF(F30<501,750+(F30-250)*2.25,IF(F30<751,1312.5+(F30-500)*1.5,IF(F30<1000,1687.5+(F30-750)*1.13,1970+(F30-1000)*0.75)))))

Please keep in mind that if your milestones change or your RM rates change the formulas will no longer give the correct results.

Edit: (Also, there probably is a more efficient way of doing this than just nested IFs but I couldn't come up with it off the top of my head)

Cheers,
Catalin
 
Last edited:
Upvote 0
The only suggestion I might add to Catalin's formula is that instead of compiling a single formula for the sum, have a single formula for each mileage range and SUM for the total. Easier to update/diagnose that way.

hth
 
Upvote 0

Forum statistics

Threads
1,217,997
Messages
6,139,875
Members
450,242
Latest member
mikey18

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