Need cell formula to calculate storage fee based on unloaded date.

steve400243

Active Member
Joined
Sep 15, 2016
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, I am trying to get the correct cell formula to calculate the storage fee for each row.
Rate is $3.50 PER CBM - 6 Free Calendar Days, including Unloaded Date, $50.00 min Charge for next 5 Days, (Day 7 thru 11) -
12th Day - Additional $3.50 per CBM, per day - No Min

TEST SHEET STORAGE.xlsx
EFGQRS
1
2
3
4Unloaded On: Storage 7th Day:Storage 12th Day:
515-Aug-202121-Aug-202126-Aug-2021
6
7CBM: STORAGE: TOTAL:
88.92$ -$ -
97.5$ -$ -
103.2$ -$ -
111$ -$ -
1210.9$ -$ -
1315.89$ -$ -
14
Sheet2
Cell Formulas
RangeFormula
F5F5=E5+6
G5G5=E5+11
S8:S13S8=Q8+R8


 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Not sure if I understood your instructions correctly but here's my suggestion.

I start solving this by creating a 3 x 3 cell table for the charges:
The first column has values 0, 6 and 11 on it (the number of days where charges change).
The second column has min charges for each interval and the last column has the daily charges from that day on.

I created named ranges for these columns to make the formula easier to read and undestand.
The columns in the charge table are called "NODs", "MinCharges" and "DailyCharges".
"StorageDays" is a simple formula that counts the days between the unloading date and the last date ( = Last Date - Unloading Date )
And finally I created a named range for the number of free days ( "FreeDays" ).
In my formula the "LDMs" stands for the number of LDMs on the row.

Having said that here's my basic formula:
Excel Formula:
=MAX(
    INDEX(MinCharges,MATCH(StorageDays,NODs)),
    INDEX(DailyCharges,MATCH(StorageDays,NODs))*LDMs*(MAX(StorageDays-FreeDays,0))
)
I split the formula in rows to make it easier to follow as I try to explain the logic:

Basically it is a simple MAX formula that compares the min charges ( = the first INDEX formula ) and the daily charges ( = the second INDEX formula ).

The MATCH(StorageDays,NODs) on both INDEX formulas finds the row where it takes the value from. The first INDEX takes the value from the MinCharges column and the second on from the DailyCharges column. After that the DailyCharges value is multiplied by the number of LDMs and StorageDays - FreeDays. In case the StorageDays is less than FreeDays I wrapped that in another MAX to make sure we don't get negative values for the number of days.

That's basically all there is to it but as I said in the beginning I'm not sure I understood the instructions correctly.
This would be all there is to it if you can simply compare the daily charges with the min charges.

If you have to do the calculation in two steps ( first for the first 10 days and then for the days from 11 on ) you'd have to use the same formula twice with adjustments on the StorageDays bit.
Or - since you already know the StorageDays in the first part is always 10 or less - you could replace the INDEXes with a couple of IFs and actual cell references:
If StorageDays < FreeDays return 0, else compare the daily charges to the minimum charge.
And if the actual StorageDays is greater than 10 add the daily charges for the StorageDays from the 11th day on.

However, to make your formulas as flexible as possible for the changes in the future, make sure you have all your constants as cell references.
 
Upvote 0
Solution
Thank you for the explanation and for looking at this Misca. I appreciate it. My sincere apologies but I left out the Pickup date. This is the date that would stop the clock from calculating the days. This date would be Starting in cell L8.

TEST SHEET.xlsx
EFGLQRST
1
2
3
4Devanned On: Storage 7th Day:Storage 12th Day:
53-Sep-20219-Sep-202114-Sep-2021
6
7Mode:Cartons:CBM:Pickup Date: WHSE FEE: STORAGE: TOTAL:
8FMM1510.5$ 189.00$ -$ 189.00
9FMM1510.55-Sep$ 189.00$ -$ 189.00
10FMM1510.5$ 189.00$ -$ 189.00
11FMM1510.55-Sep$ 189.00$ -$ 189.00
12FMM1510.55-Sep$ 189.00$ -$ 189.00
13FMM1510.5$ 189.00$ -$ 189.00
14
15
Sheet2
Cell Formulas
RangeFormula
F5F5=E5+6
G5G5=E5+11
Q8:Q13Q8=G8*18
S8:S13S8=Q8+R8
 
Last edited:
Upvote 0
I thought you did. In my explanation I call it "Last Date". You won't find it in the actual formula but it's needed to calculate the value of the StorageDays variable ( = Last Date - Unloading Date ).
 
Upvote 0
I thought you did. In my explanation I call it "Last Date". You won't find it in the actual formula but it's needed to calculate the value of the StorageDays variable ( = Last Date - Unloading Date ).
Ah got it - Thank you again, I believe I have what I need now. Appreciate you assistance!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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