Spread Prepayments over specified period (Start & End Date)

Roggy_Swiss

New Member
Joined
May 30, 2013
Messages
10
Hi all. I am trying to automate a Prepayment file. Basically I have the following data given in a row (entered via UserForm: -Amount of Invoice (+currency etc but not relevant in this context), start date, end date. In the columns there are months starting in July 2013 to June 2014. As I am setting a VBA controlled file with userforms, I need to automate the calculation of the amount in each specific month. So if an invoice is EUR 15000 for lets say Insurance for October, November, December 2013, I want the formula to look at start date, end date and the enter the values in each month concerned, in this case in the colums Oct, Nov and Dec 12 of EUR 5000 in each (Month approach). But as an invoice is not always for exact whole months, but sometimes starting on the 15th and ending on the 5th I would very much prefer a Day approach. Currently I have the following formula: =IFERROR(($M5/(DATEDIF($N5;$O5;"d"))*IF(ISERROR(DATEDIF(MAX($N5;P$4);MIN($O5;Q$4);"d"))=TRUE;"";DATEDIF(MAX($N5;P$4);MIN($O5;Q$4);"d")));"") ---- M5=Invoice amount, N5=Start Date, O5=End Date, P4=Jul 13,Q4=Aug 13 etc. This works quite good but the last month is alway a bit odd, meaning if the last month has 31 days the formula gives the same value as for a month with 30 days. Could anyone help me get the days right? I would be quite happy to have shorter formula than the one above. THANKS ALOT ALREADY!!! Regards, Roggy
 
Thank you very much, David. Is there a way to do this formula in an array? Or is it impossible?

Also if there is no start and end date, but an extra column with the date it is approved, is there a way to spread it over that date instead?

Thank you very much for the effort.

Cheers,
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
"do this formula in an array? Or is it impossible? "

I do not use Google's Sheets, you will need to work out the Array solution,

In Excel,
- the formula will copy or fill down
- you could use a Data Table

"Also if there is no start and end date, but an extra column with the date it is approved, is there a way to spread it over that date instead?"

Did you try the suggested solution?
 
Upvote 0
"do this formula in an array? Or is it impossible? "

I do not use Google's Sheets, you will need to work out the Array solution,

In Excel,
- the formula will copy or fill down
- you could use a Data Table

"Also if there is no start and end date, but an extra column with the date it is approved, is there a way to spread it over that date instead?"

Did you try the suggested solution?
 
Upvote 0
You can edit and combine the following to address your requirements.
You know your data and your requirements.


Excel 2010
ABCDEFGHI
2ApprovedContractCurrent ?CurrentStarting DateEnding DateContract AmountJun-13Jul-13
3YA_222-2013TRUE120,000.0016-Jun-13120,000.00120,000.000.00
416-Jun-13A_222-2013120,000.00120,000.000.00
5
3aa
Cell Formulas
RangeFormula
C3=AND(A3="Y",OR(E3="",F3=""))
D3=C3*G3
H3=($C3=TRUE)*($E3>=H$2)*($E3)*$D3
H4=(A4>=$K$7)*(A4<=$L$7)*($A4>=H$2)*($A4)*$G4
 
Upvote 0
Excel 2010
ABCDEFGHIJKL
1
2ApprovedContractCurrentStarting DateEnding DateContract AmountJun-13Jul-13Aug-13Sep-13Oct-13Nov-13
3Y0.0015-Jun-1330-Sep-13100,000.0014,814.8128,703.7028,703.7027,777.780.000.00
4Y100,000.0016-Jun-13100,000.000.000.000.000.000.000.00
5
3a
Cell Formulas
RangeFormula
G3=(($A3="Y")*(ISNUMBER($D3))*(ISNUMBER($E3)))*MAX(0,MIN(H$2,$E3+1)-MAX(G$2,$D3))/($E3-$D3+1)*$F3
G4=(($A4="Y")*(ISNUMBER($D4))*(ISNUMBER($E4)))*MAX(0,MIN(H$2,$E4+1)-MAX(G$2,$D4))/($E4-$D4+1)*$F4
H3=(($A3="Y")*(ISNUMBER($D3))*(ISNUMBER($E3)))*MAX(0,MIN(I$2,$E3+1)-MAX(H$2,$D3))/($E3-$D3+1)*$F3
H4=(($A4="Y")*(ISNUMBER($D4))*(ISNUMBER($E4)))*MAX(0,MIN(I$2,$E4+1)-MAX(H$2,$D4))/($E4-$D4+1)*$F4
I3=(($A3="Y")*(ISNUMBER($D3))*(ISNUMBER($E3)))*MAX(0,MIN(J$2,$E3+1)-MAX(I$2,$D3))/($E3-$D3+1)*$F3
I4=(($A4="Y")*(ISNUMBER($D4))*(ISNUMBER($E4)))*MAX(0,MIN(J$2,$E4+1)-MAX(I$2,$D4))/($E4-$D4+1)*$F4
J3=(($A3="Y")*(ISNUMBER($D3))*(ISNUMBER($E3)))*MAX(0,MIN(K$2,$E3+1)-MAX(J$2,$D3))/($E3-$D3+1)*$F3
J4=(($A4="Y")*(ISNUMBER($D4))*(ISNUMBER($E4)))*MAX(0,MIN(K$2,$E4+1)-MAX(J$2,$D4))/($E4-$D4+1)*$F4
K3=(($A3="Y")*(ISNUMBER($D3))*(ISNUMBER($E3)))*MAX(0,MIN(L$2,$E3+1)-MAX(K$2,$D3))/($E3-$D3+1)*$F3
K4=(($A4="Y")*(ISNUMBER($D4))*(ISNUMBER($E4)))*MAX(0,MIN(L$2,$E4+1)-MAX(K$2,$D4))/($E4-$D4+1)*$F4
L3=(($A3="Y")*(ISNUMBER($D3))*(ISNUMBER($E3)))*MAX(0,MIN(M$2,$E3+1)-MAX(L$2,$D3))/($E3-$D3+1)*$F3
L4=(($A4="Y")*(ISNUMBER($D4))*(ISNUMBER($E4)))*MAX(0,MIN(M$2,$E4+1)-MAX(L$2,$D4))/($E4-$D4+1)*$F4
C3=AND(A3="Y",OR(D3="",E3=""))*F3
C4=AND(A4="Y",OR(D4="",E4=""))*F4


N.B. This is not an array formula.
G2 Jun-13 is a date June 1 2013 and the other dates are also 1st of the applicable months.
Hopefully this will translate to Google

Hi Dave

Thank you so much for this, is there away to change this to calculate flat monthly amount rather than based on days in the month?
 
Upvote 0
You can start a new thread for your question.
try searching for threads that meet your requirements

N.B. You can post an extract of your sheet with the forum's tool named XL2BB.
 
Upvote 0
You can start a new thread for your question.
try searching for threads that meet your requirements

N.B. You can post an extract of your sheet with the forum's tool named XL2BB.
Done :)

Thank you David
 
Upvote 0

Forum statistics

Threads
1,215,603
Messages
6,125,776
Members
449,259
Latest member
rehanahmadawan

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