Page 1 of 1

the Excel functions in pb

Posted: Sun Mar 31, 2019 3:40 pm
by Alireza
hi all
i need some excel-functions in pb: PMT - PPMT - IPMT
is there a similar things in PB :?:

Re: the Excel functions in pb

Posted: Sun Mar 31, 2019 5:21 pm
by skywalk

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

Re: the Excel functions in pb

Posted: Mon Apr 01, 2019 6:50 am
by Alireza
that is work! very thanks dear man :D :D :D :D :D :D :D
TX