the Excel functions in pb

Just starting out? Need help? Post your questions and find answers here.
User avatar
Alireza
Enthusiast
Enthusiast
Posts: 143
Joined: Sat Aug 16, 2008 2:02 pm
Location: Iran

the Excel functions in pb

Post by Alireza »

hi all
i need some excel-functions in pb: PMT - PPMT - IPMT
is there a similar things in PB :?:
PB v 5.6 :D
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: the Excel functions in pb

Post 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
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Alireza
Enthusiast
Enthusiast
Posts: 143
Joined: Sat Aug 16, 2008 2:02 pm
Location: Iran

Re: the Excel functions in pb

Post by Alireza »

that is work! very thanks dear man :D :D :D :D :D :D :D
TX
PB v 5.6 :D
Post Reply