The VBA Pmt Function
Related Functions:VBA IPMTVBA PPMT
The VBA Pmt function calculates the constant periodic payments required to pay a loan or investment that has a fixed interest rate.
The syntax of the function is:
Pmt( Rate, Nper, Pv, [Fv], [Due] )
Where the function arguments are:
|Rate||-||The interest rate, per period.|
|Nper||-||The number of periods over which the loan or investment is to be paid.|
|Pv||-||The present value of the loan / investment.|
An optional argument that specifies the future value of the loan / investment.
If omitted, [Fv] uses the default value 0.
An optional argument that defines whether the payment is due at the start or the end of the period.
The [Due] argument can have the value 0 or 1, meaning:
0 - the payment is due at the end of the period;
1 - the payment is due at the beginning of the period.
If the [Due] argument is omitted, it uses the default value 0 (denoting payments due at the end of the period).
Cash Flow Sign Convention:
Note that, in line with the general cash flow sign convention, cash outflows are represented by negative numbers and cash inflows are represented by positive numbers.
This is seen in the example below.
VBA Pmt Function Example
In the following VBA code, the VBA Pmt function is used to calculate the monthly payments on a loan of $50,000 which is to be paid off in full after 5 years. Interest is charged at a rate of 5% per year and the loan payments are made at the end of each month.
|Dim mthlyPmt As Double|
mthlyPmt = Pmt( 0.05/12, 60, 50000 )
The above VBA code calculates that a monthly payment of $943.56 is required, to pay off the loan in full over 5 years.
- As the payments are monthly, the annual interest rate of 5% is divided by 12 to calculate the monthly interest rate. Also, the number of periods during the 5 years of the annuity is supplied as 60 months.
- In the example, the future value of the annuity is 0, and so the [Fv] argument can be omitted from the Pmt function.
- In the example, the payments are due at the end of each period. Therefore, the [Due] argument can also be omitted from the Pmt function.
- The result from the Pmt function is a negative number, indicating that the calculated payments are outgoing.
VBA Pmt Function Error
If the supplied Nper is equal to 0, the VBA Pmt function produces the error:
Run-time error '5': Invalid procedure call or argument