`IPmt` 回傳指定期數的利息部分,適用於固定利率、定期定額付款的年金(貸款/投資)。語法:IPmt(rate, per, nper, pv, [fv], [type])。參數單位須一致(如月利率對應總期數月數),現金流出用負數、流入用正數。
rate:每期利率(年利率/12)。per:欲計算的期數(1 到 nper)。nper:總付款期數。pv:現值(貸款本金)。fv(選填):未來值,預設 0。type(選填):0=期末付、1=期初付,預設 0。Dim FVal, Fmt, PVal, APR, TotPmts, PayType, Period, IntPmt, TotInt, Msg
Const ENDPERIOD = 0, BEGINPERIOD = 1
FVal = 0: Fmt = "###,###,##0.00"
PVal = InputBox("貸款金額?")
APR = InputBox("年利率?"): If APR > 1 Then APR = APR / 100
TotPmts = InputBox("總期數(月)?")
PayType = MsgBox("月底繳款?", vbYesNo)
If PayType = vbNo Then PayType = BEGINPERIOD Else PayType = ENDPERIOD
For Period = 1 To TotPmts
IntPmt = IPmt(APR/12, Period, TotPmts, -PVal, FVal, PayType)
TotInt = TotInt + IntPmt
Next
MsgBox "總利息:" & Format(TotInt, Fmt)
可用於貸款利息明細表、投資收益分析。