VBA IRR on Amortization Tabl

BTFinance

New Member
Joined
Mar 3, 2017
Messages
3
I'm looking for a way to use VBA to calculate the IRR of the cashflows of an amortization table without actually needing an amortization table in my workbook, but rather just the loan attributes. I currently use the following function to calculate the cumulative interest paid given the amortization month that can potentially be used for a starting point.

Anybody have any ideas? Let me know if I need to provide more information.

Code:
Function CumIntPSA(Starting_Balance, Original_Months, Loan_Age, Gross_Rate, Optional PSA = 0, Optional DelayDays = 30)
Dim CI As Variant
rm = Original_Months
gr = Gross_Rate / 12
'smm = -((1 - CPR / 100) ^ (1 / 12) - 1) 'Montly Prepayment
dd = (DelayDays - 30) / 30 'Default = 30, a 15 day grace period would be 44
cm = rm - Loan_Age
sb = Starting_Balance 'Starting Balance
CI = 0 ' Accumulate Interest
am = i + DL ' Month for prv


'Start Amortization
For i = 1 To cm


am = i + dd 'Adjusted month for prv
Interest = gr * sb
payment = Application.WorksheetFunction.Pmt(gr, cm, -sb) 'Calculate new payment
amort = payment - Interest  'Normal Amortization


'PSA Prepayments
prepay = ((1 - WorksheetFunction.Min(100, PSA * WorksheetFunction.Min(0.002 * (i + Loan_Age), 0.06)) / 100) ^ (1 / 12) - 1) * -1 * (sb - amort)


'Paydown
sb = sb - amort - prepay - delinquency
  
CI = CI + Interest
 
cm = cm - 1
Next i


CumIntPSA = CI
End Function
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,223,157
Messages
6,170,419
Members
452,325
Latest member
BlahQz

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