The IPmt (Interest Payment) function in VBA calculates the interest portion of a given loan or investment payment in a specific period. It is a financial function that is used to assess the amount of interest that is paid during a particular payment period, to help users understand how much interest they are paying on their loans or earning on their investments.

## VBA IPmt Function – Purpose, Syntax and Arguments

### Syntax:

The syntax for the IPmt function is:

IPmt(rate, per, nper, pv, [fv], [type])

where:

**rate** is the interest rate per period.

**per** is the specific period for which the interest payment is to be calculated.

**nper** is the total number of payment periods in the loan or investment.

**pv** is the present value or current amount of loan or investment.

**[fv]** (optional) is the future value or desired target amount of loan or investment.

**[type]** (optional) indicates whether payments are due at the beginning (0) or end (1) of each period.

### Arguments:

The **rate** argument can be entered as a percentage or decimal number. For example, 5% can be entered as either 0.05 or 5.

The **per** argument must be a whole number that is between 1 and the total number of payment periods.

The **nper** argument must be a positive whole number.

The **pv** argument must be a negative number if you are taking out a loan or investing a certain amount. It must be a positive number if you are borrowing or receiving a certain amount.

The **[fv]** argument is optional and must be a positive number.

The **[type]** argument is optional and must be either 0 or 1.

### Example:

Suppose you took out a loan of $10,000 with an annual interest rate of 6%, to be paid back in monthly installments over 5 years. You want to know how much interest you will be paying in the 12th month of the loan.

IPmt (0.06/12, 12, 5*12, -10000)

This function will return a value of $49.76, which means that in the 12th month of the loan, $49.76 of your payment will go towards paying off the interest of the loan.

### Remarks:

- The IPmt function can be used to calculate interest payments for both loans and investments.
- The IPmt function returns a negative value, which represents money paid out.
- If the interest rate or number of payment periods are not consistent, the IPmt function may not accurately reflect the total interest paid.
- The IPmt function is the inverse of the PPmt (Principle Payment) function, which calculates the principle portion of a payment.

### Important Notes:

- The IPmt function is only available in Microsoft Excel 2007 and above.
- The IPmt function may have different outputs on different versions of Excel due to slight differences in the calculation algorithms.
- The IPmt function is most commonly used in conjunction with other financial functions, such as PV (Present Value) and PMT (Payment) to analyze and make decisions about loans and investments.

## Understanding VBA IPmt Function with Examples

### Example 1 – Calculating Interest Payment for a Loan

The IPmt function is a useful tool in Microsoft Excel’s Visual Basic for Applications (VBA) that allows users to calculate the interest portion of a loan payment. This function is particularly helpful for financial analysts, accountants, or any individual who deals with loan calculations on a regular basis. The syntax of the IPmt function is as follows:

=IPmt(Rate,Per,Nper,Pv,[Fv],[Type])

Where:

**Rate**: The interest rate per period.**Per**: The period for which the interest payment is to be calculated.**Nper**: The number of total payment periods in the loan.**Pv**: The present value or the total amount borrowed.**Fv**(optional): The future value, or the remaining balance of the loan after all payments have been made. Defaulted to 0 if not specified.**Type**(optional): The type of loan payment, either 0 (payments at the end of each period) or 1 (payments at the beginning of each period). Defaulted to 0 if not specified.

To better understand the functionality of this function, let’s consider an example. Say you have taken out a loan of $50,000 with an annual interest rate of 5% and a term of 5 years. You want to know the interest payment for the second year of this loan. To calculate this using the IPmt function, you would use the following formula:

=IPmt(0.05,2,5,50000,0,0)

This would return the value of $2,500, which is the interest portion of the second year’s loan payment.

### Example 2 – Refinancing Calculator

The IPmt function can also be used in a more practical setting, such as calculating interest payments for refinancing a loan. Let’s say you want to refinance your current loan of $100,000 with an interest rate of 7% for 10 years, as you have found a new lender offering a lower interest rate of 5%. You want to know what the interest payment would be for the first year after refinancing. Using the IPmt function, it would look like this:

=IPmt(0.05,1,10,100000,0,0)

The result would be $5,000, which is significantly less than the initial interest payment of $7,000. This demonstrates the cost-saving benefits of refinancing a loan to a lower interest rate.

### Example 3 – Calculating Interest Portion of a Loan Amortization

The IPmt function can also be used to calculate the interest portion for each payment in a loan amortization schedule. An amortization schedule is a table showing how a loan is paid off over time, and it is crucial to understand the interest payments for each period to effectively manage and repay the loan. Let’s consider an example where you have a car loan of $20,000 with an annual interest rate of 6% and a term of 5 years. Using the IPmt function, you can calculate the interest portion for each of the 60 payments using the following steps:

- Create a table in Excel with the following headers: Payment Period, Payment, Principal Payment, Interest Payment, and Remaining Balance.
- In the “Payment Period” column, fill in the numbers 1 to 60 to represent the 60 months of the loan term.
- In the “Payment” column, enter the following formula in cell B2 and drag it down to cell B61: =IPmt(0.06,B2,5,20000,0,0)
- In the “Principal Payment” column, enter the following formula in cell C2 and drag it down to cell C61: =PMT(0.06,5,20000)
- In the “Interest Payment” column, enter the following formula in cell D2 and drag it down to cell D61: =B2-C2
- In the “Remaining Balance” column, enter the following formula in cell E2 and drag it down to cell E61: =100×((1+0.06)^5−(1+0.06)^B2)/(1+0.06)^5

The resulting table would look something like this:

Payment Period | Payment | Principal Payment | Interest Payment | Remaining Balance |
---|---|---|---|---|

1 | $386 | $344 | $42 | $19,656 |

2 | $386 | $348 | $38 | $19,308 |

3 | $386 | $352 | $34 | $18,956 |

This table shows how much of each payment goes towards the principal, how much towards the interest, and the remaining balance after each payment. The IPmt function is used to calculate the interest payment for each period, while the PMT function is used to calculate the principal payment. By using VBA, this table can be automatically generated and updated if any of the loan details, such as the interest rate or term, are changed.

### Conclusion

The IPmt function in VBA is a powerful tool that can be used to calculate the interest portion for a loan payment, refinancing a loan, or in creating an amortization schedule. Its versatility and simplicity make it a valuable function for financial professionals and individuals alike. Understanding the basics of this function can help in making informed financial decisions and managing loans efficiently.