The VBA IPmt Function
Related Functions:VBA PMTVBA PPMT
For a loan or investment that is paid by constant periodic payments and has a constant interest rate, the VBA IPmt function calculates the interest part of the payment, during a specific period.
The syntax of the function is:
IPmt( Rate, Per, Nper, Pv, [Fv], [Due] )
Where the function arguments are:
|Rate||-||The interest rate, per period.|
|Per||-||The period number for which you want to calculate the interest payment (must be an integer between 1 and Nper).|
|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 IPmt Function Example
In the following VBA code, the VBA IPmt function is used to calculate the interest payments during months 1 and 2 of a loan of $50,000 which is to be paid off in full over 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 intMth1 As Double
Dim intMth2 As Double
intMth1 = IPmt( 0.05/12, 1, 60, 50000 )
intMth2 = IPmt( 0.05/12, 2, 60, 50000 )
The above VBA code calculates that:
- The interest payment during month 1 = $208.33;
- The interest payment during month 2 = $205.27.
- 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 is supplied as 60 months.
- In the example, the future value of the loan is 0, and so the [Fv] argument can be omitted from the IPmt function.
- In the example, the payments are due at the end of each period. Therefore, the [Due] argument can also be omitted from the function.
- The results from the IPmt function are negative numbers, indicating that the calculated interest payments are outgoing.
VBA IPmt Function Error
If the VBA IPmt function is supplied with a Per that is ≤ 0 or > Nper, you will get the error:
Run-time error '5': Invalid procedure call or argument