i need some excel-functions in pb: PMT - PPMT - IPMT
is there a similar things in PB

Code: Select all
Procedure.d ML_PMT(Rate_pc.d, nMonths.i, LoanAmount.d)
; Calculate loan payment given monthly interest payments.
; Syntax of MS Excel PMT(rate,nper,pv,fv,type):
; Rate = Interest rate
; Nper = Total number of payments
; Pv = Present value/principal. Total amount a series of future payments is worth now.
; Fv = Future value. cash balance after last payment. default = 0.
Rate_pc / 12 / 100 ; Convert to monthly % rate
Protected.d pmt = Pow(Rate_pc + 1, nMonths)
pmt = LoanAmount * pmt * Rate_pc / (pmt - 1)
ProcedureReturn pmt
EndProcedure
Debug StrD(ML_PMT(5, 12*5, 100e3),2) ; 5 year loan of $100k @5% = $1887.12