I would like to calculate the IRR of my savings insurance based on the total premium paid, years of payment, policy years, and the value received at the end of policies.
For example:
- total premium paid = 50,000
- years of premium payment = 5
- policy years = 20
- value received at the end of 20 years = 125,000
I know it is achievable using the IRR function, however I dont want to change the number of rows, my payment per year and etc every time when I want to make a comparison.
I have found smtg similar which is answered Here, however it does not exactly fulfill my requirement. How can i modify the VBA code to suit my need??
Function CIRR(TotalPremiumPaid, timePeriod, finalValue)
eachValue = TotalPremiumPaid / timePeriod
Dim cashFlow() As Double
Dim n As Integer
ReDim cashFlow(0 to timePeriod)
For n = 0 To (timePeriod - 1)
cashFlow(n) = -1 * eachValue
Next n
cashFlow(timePeriod) = finalValue
CIRR = IRR(cashFlow)
End Function
Thanks a lot