PV*((1+ rate)^NPER)+ PMT*(1+rate*type)*(((1+ rate)^NPER)-1)/rate+FV = 0

so rearranging to solve PV

PV = -1*(FV+ PMT*(1+rate*type)*(((1+ rate)^NPER)-1)/rate)/((1+ rate)^NPER)

Cheers

Dave

Solved

Posted on 2004-11-29

I need to programatically calculate present value. Excel has the function PV(rate,nper,pmt,fv,type) that I need reproduce exactly in javascript (I would think it would basically be the same in any language). The parameters are :

rate: interest rate per period

nper: total # of payment periods

pmt: the payment made each period

fv: the future value, or a cash balance you want to attain after the last payment is made

type: indicate if payment is made at the beginning or end of the period

Has anyone ever had to produce this mathmatical calculation in a program that they can share the algorithm with me

If I ever needed an expert this is the time.

5 Comments

PV*((1+ rate)^NPER)+ PMT*(1+rate*type)*(((1+ rate)^NPER)-1)/rate+FV = 0

so rearranging to solve PV

PV = -1*(FV+ PMT*(1+rate*type)*(((1+ rate)^NPER)-1)/rate)/((1+ rate)^NPER)

Cheers

Dave

I could not seem to get this equation to produce the exact same results as Excel did with the same data. I did some further searching and found this equation that seems to produce the same results as Excel (within a few pennies)

http://www.investopedia.co

thanks anyway

The formula will give the same answer as it is just a rearrangement of the Excel PV formula

See this example, www.vbaexpress.com/brettdj

Cheers

Dave

By clicking you are agreeing to Experts Exchange's Terms of Use.

Title | # Comments | Views | Activity |
---|---|---|---|

countTriple challenge | 8 | 59 | |

canBalance challenge | 34 | 55 | |

cmd.exe will not close when running .bat file to perform FTP upload | 18 | 46 | |

Looking for example pivot year code used in Y2K | 4 | 12 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**22** Experts available now in Live!