The VBA RATE function is listed under the financial category of VBA functions. When you use it in a VBA code, it returns the interest rate per period (with equal cash flow) for a loan or investment.
RATE(Nper, Pmt, Pv, [Fv], [Due], [Guess])
- Nper: The number of periods to pay the loan or investment.
- Pmt: The fixed amount of payment per period.
- PV: The present value of investment or loan.
- [FV]: The future value of the loan/investment (This is an optional argument and if omitted VBA takes 0 by default).
- [Due]: Defines whether the payment is due at the start or the end of the period, use 0 for the end of the period and 1 for the start of the period [This is an optional argument and if omitted VBA takes the end of the period by default].
- [Guess]: An initial estimate (guess) of what will be the IRR [This is an optional argument and if omitted VBA takes 10% (=0.1) by default].
To practically understand how to use the VBA RATE function, you need to go through the below example where we have written a vba code by using it:
Sub example_RATE() Range("A8") = Rate(60, -1200, 0, 98000, 1) * 12 End Sub
In the above code, we have used RATE to calculate the interest rate of the investment where we have 60 months, 1200 of the monthly payment, and 98000 of the future value of the investment, and in the end, we have multiplied it with the 12 to get the annual rate of the interest.
- While using RATE any cash paid out is represented by a negative number and any cash received is represented by a positive number.
- It calculates rate iteration. It can’t find the result in 20 tries, it returns a run-time of 5.