James said:
wrap also. Maybe I'll play with this some more to see how I would do it
without the PPmt() function.
The problem with relying on the PPmt function is that it doesn't scale
upwards well (depending on what functions the upward platform has).
I'll explain what I did in a backwards fashion.
Here's a version (one-liner) that doesn't rely on the PPmt function:
Public Function CumulativePrinciple(dblIntRatePerPeriod As Double,
NPeriods As Integer, PresentValue As Double, StartPeriodNumber As
Integer, EndPeriodNumber As Integer, intTimingType As Integer) As Double
CumulativePrinciple = ((1 + dblIntRatePerPeriod) ^ (EndPeriodNumber + 1
- intTimingType) - (1 + dblIntRatePerPeriod) ^ (StartPeriodNumber -
intTimingType)) * (PresentValue - PresentValue * (dblIntRatePerPeriod *
(1 + dblIntRatePerPeriod) ^ (NPeriods - intTimingType)) / ((1 +
dblIntRatePerPeriod) ^ (NPeriods - intTimingType) - 1) /
dblIntRatePerPeriod)
End Function
Multiple line version:
Public Function CumulativePrinciple(dblIntRatePerPeriod As Double,
NPeriods As Integer, PresentValue As Double, StartPeriodNumber As
Integer, EndPeriodNumber As Integer, intTimingType As Integer) As Double
Dim dblNperMult As Double
Dim dblA As Double
Dim dblStartMult As Double
Dim dblEndMult As Double
dblNperMult = (1 + dblIntRatePerPeriod) ^ NPeriods
dblA = PresentValue * (dblIntRatePerPeriod * dblNperMult) / (dblNperMult
- 1) 'Annuity equivalent to PV
dblStartMult = (1 + dblIntRatePerPeriod) ^ (StartPeriodNumber -
intTimingType)
dblEndMult = (1 + dblIntRatePerPeriod) ^ (EndPeriodNumber + 1 -
intTimingType)
CumulativePrinciple = (dblEndMult - dblStartMult) * (PresentValue - dblA
/ dblIntRatePerPeriod)
End Function
I took a guess at how to apply the intTimingType. I can't run the
CUMPRINC function in Excel because I don't have the analysis pack so I
would love to see some sample outputs with intTimingType = 1 to see if
my guess was correct. I'd even be interested in seeing if the function
works on more examples than what are given in the Excel help when
intTimingType = 0. I started by using the following function:
Public Function PRj(PresentValue As Double, dblIntRatePerPeriod As
Double, NPeriods As Integer, PeriodNumber As Integer) As Double
Dim dblNperMult As Double
Dim dblPeriodNumberMult As Double
Dim dblA As Double
dblNperMult = (1 + dblIntRatePerPeriod) ^ NPeriods
dblA = PresentValue * (dblIntRatePerPeriod * dblNperMult) / (dblNperMult
- 1)
dblPeriodNumberMult = (1 + dblIntRatePerPeriod) ^ PeriodNumber
PRj = PresentValue * dblPeriodNumberMult + dblA * (1 -
dblPeriodNumberMult) / dblIntRatePerPeriod
End Function
which gives the Principle remaining to be paid after PeriodNumber
periods have passed. The difference, after adjusting to include the
entire ending period, gives the amount of principle paid within the
range of periods. That function was obtained by solving the following
recurrence relation:
PR(j+1) = PR(j) * (1 + i) - A
or, previously,
PR(j+1) = PR(j) - (A - PR(j) * i)
I.e., the monthly payment minus the interest on the prior Principle
remaining is the amount to subtract to get the new Principle remaining.
James A. Fortune
(e-mail address removed)