Hi Flashcoders,

I got a problem which I am in no way to figure out myself,
but someone here probably has a solution.

I found this function when I googled:

function Pmt(r, np, pv, fv) {
   r = r/1200;
   pmt = -(r*(fv+Math.pow(1+r, np)*pv)/(-1+Math.pow(1+r, np)))
   return(pmt);
}

trace( Math.round(Pmt(5, 36, -273168.6, 190300)) );


BUT, the problem is that this "PMT"-function, which am used in programs like Excel, .Net and so on,
also have a fifth paramater in which you can send in 0 or 1.

The function above behaves like sending in "0" as the fifth parameter -as in as the loan is paid of the last day in the month. But I need to send in "1", and get the result of when the loan is being paid off the first every month.

the code above traces out "3277", and that is correct if I wanted it to be when the loan is being paid of the last day in every month, but I really need it to calculate the monthly payment as occuring the last day of every month. So I really
want it to be 3263 ;)

Do you know how the line of code can be altered so it suits me?

Here is a description of the "standard" PMT, how it works:
http://www.techonthenet.com/excel/formulas/pmt.php

Thanks, Martin



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to