Very tough - storage fee calculation

sony

Board Regular
Joined
Jun 15, 2002
Messages
126
dear pls see the table

Only useful columns for calculation are only:
Column F : Date-in
Column G : Date-out
Column L : Volume out (cbm)

Charging Period : 21st to 20th of every month

I wonder if VBA codes can help calculate storage fee for each charging period and put in the Column M & N, O..n Etc I produce the idea result in the column M, N in red colour for the amount. you can refer to

charging formula is
US$ 3 X VolumeOut (cbm) X Storage days
(Storage Days = Date-out Less Date-In)


the difficult tings are
1) there can be many date-out records for each Date-in shipment. e.g. look at D8749, D8752 they are two deliery out for the shipemnts)

2) If the storage period cross many charging period, excel will auto put the amt in column O, P, R, S, etc.
INVENTORY REPORT1.xls
DEFGHIJKLMN
8PO#(SR#)/DOno.VendornameDateQuantity(PC)Volume(CBM)
9InOutInOutBalanceInOutJuneCharges21stJuneto20thJuly)JulyCharges21stJulyto20thAug)
10
1100002425(AF27FI04)ZDL7/15/20027200720050
12D87498/19/2002360025$375$2250
13D87529/5/2002360025$375$2250
14
1500002425(AF27FI04)ZDL7/16/20027245724553.47
16D87498/2/20027245053.47
17
1800002425(AF27FI04)ZDL7/17/20026809680950.67
19D87498/2/20026809053.47
20
2100002426(AF27FG08)ZDL7/18/2002126001260050.96
22D87498/2/200212600050.96
23
2400002426(AF27FG08)ZDL7/23/20027000700027.89
25D87498/2/20027000027.89
26
AUG
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
If you duplicate the in date on the row that contains the out information, the calculation becomes pretty simple. Something like the untested<pre>MIN(out-date - in-date, period-end-date - period-start-date, period-end-date - in-date)* out-CBM * daily-rate-per-CBM.</pre>Basically, in your layout, the only 'challenge' is figuring out the in-date that corresponds with each out-date.
 
Upvote 0
Dear Tusharm, than you for your kindness in reading & replying my question.
But the answer looks not correct

e.g. if shipment is in 7/15 & out 8/19
suppose the June period (6/21 to 7/20) only count 5 days in M12 whereas July period (7/21 to 8/20) counts 30 days in N12

but the formula cannot produce the correct no of days in its perodnot to say calculate the fees.

Could you please help me again
 
Upvote 0
Dear Tusharm, than you for your kindness in reading & replying my question.
But the answer looks not correct

e.g. if shipment is in 7/15 & out 8/19
suppose the June period (6/21 to 7/20) only count 5 days in M12 whereas July period (7/21 to 8/20) counts 30 days in N12

but the formula cannot produce the correct no of days in its period not to say calculate the fees.

Could you please help me again
 
Upvote 0
Dear Tusharm,

I got it by adjusting the in & out date in next period, I now got what you meant, sorry for my being stupid. You are genius!

Best wishes
 
Upvote 0
tusharm, for your information,
storage-fee.xls
ABCDEFG
1startperiod21-Jun-0221-Jul-0221-Aug-0221-Sep-02
2in-dateou-dateendperiod20-Jul-0220-Aug-0220-Sep-0220-Oct-02
315-Jul-0225-Sep-02530305
Sheet1
 
Upvote 0
tusharm, for your information,
storage-fee.xls
ABCDEFG
1startperiod21-Jun-0221-Jul-0221-Aug-0221-Sep-02
2in-dateou-dateendperiod20-Jul-0220-Aug-0220-Sep-0220-Oct-02
315-Jul-0225-Sep-02530305
Sheet1
 
Upvote 0
tusharm, for your information,
storage-fee.xls
ABCDEFG
1startperiod21-Jun-0221-Jul-0221-Aug-0221-Sep-02
2in-dateou-dateendperiod20-Jul-0220-Aug-0220-Sep-0220-Oct-02
315-Jul-0225-Sep-02530305
Sheet1
 
Upvote 0
tusharm, for your information,
storage-fee.xls
ABCDEFG
1startperiod21-Jun-0221-Jul-0221-Aug-0221-Sep-02
2in-dateou-dateendperiod20-Jul-0220-Aug-0220-Sep-0220-Oct-02
315-Jul-0225-Sep-02530305
Sheet1
 
Upvote 0
tusharm, for your information,
storage-fee.xls
ABCDEFG
1startperiod21-Jun-0221-Jul-0221-Aug-0221-Sep-02
2in-dateou-dateendperiod20-Jul-0220-Aug-0220-Sep-0220-Oct-02
315-Jul-0225-Sep-02530305
Sheet1
 
Upvote 0

Forum statistics

Threads
1,216,507
Messages
6,131,059
Members
449,616
Latest member
PsychoCube

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