This example uses the NPer function to return the number of periods over which payments must be made to pay off a loan whose value is contained in PVal. Also provided are the interest percentage rate per period (APR / 12), the payment (Payment), the future value of the loan (FVal), and a number that indicates whether the payment is due at the beginning or end of the payment period (PayType).
IPmt([APR] / 12, [Period], [TotPmts], -[PVal], [FVal], [PayType])