Language Reference Guide : Functions : Finance Library Functions : IPMT Function
 
Share this page          
IPMT Function
The IPMT function calculates the interest portion of a payment for a specified period in the life of a loan, given the amount of the loan and a given rate of interest. It is based on the same equation as the FV Function.
This function has the following syntax:
IPMT(period = value, pv = value, i = value, nper = value, fv = value, paybegin, byref(context))
Note:  Paybegin is either 1 or 0, indicating that the payment is made at the beginning or end of the period.
Arguments
Data Type
Description
period
Float
Specific period ( 1 - nper )
pv
Float
Present value
i
Float
Interest per period
nper
Integer
Number of periods
fv
Float
Future value
paybegin
Integer
1 = beginning of period
0 = end of period
Default: 0
context
PMT_CONTEXT
Payment context (see following note)
Note:  The context, which is used internally to improve the efficiency of repetitive IPMT calls, must be declared as PMT_CONTEXT and passed using byref().
This function returns:
Float—The interest portion for the specified period
Null—On error
Example—IPMT function:
/*  In the following example period and interest are
**  EntryFields of DataType Float. A specific period
**  would be entered in the period field. There is
**  also a ButtonField named btn_ipmt. The frame
**  script is shown below. The loan is for $10,000
**  for 48 months at 7% interest per year.
*/
on initialize =
declare
    context = PMT_CONTEXT;
enddeclare
on click btn_ipmt =
begin
interest = ipmt(period = period,
       pv = 10000,
        i = .07/12,
     nper = 48,
       fv = 0,
 paybegin = 0,
  context = byref(context));
if interest is NULL then
    message 'Failed to calculate interest portion';
endif;
end