1

I run the following Excel function to calculate weekly re-payments.

CELL B4 = 15000
=(PMT(6.5%/12,60,(-B4),(0.2*B4),1))*12/52

Where 6.5% = rate, 60 = number of payments, 0.2*15000 = balloon and *12/52 is for calculating weekly repayments.

The output of the above is 57.62, however when coding it up in JS I end up with 77.11 as the result. After checking through it several times I can't seem to find where I've gone wrong.

Calculation for PMT is done as follows.

var q = Math.pow(1 + rate_per_period, number_of_payments);
return -(rate_per_period * (future_value + (q * present_value))) / ((-1 + q) * (1 + rate_per_period * (type)));

I've created a fiddle showing my PMT calculations.

Also, I am using an almost exact copy of the accepted answer in another question here on SO but mine varies slightly.

Community
  • 1
  • 1
DT.DTDG
  • 765
  • 1
  • 13
  • 31
  • Possible duplicate of [Excel PMT function in JS](http://stackoverflow.com/questions/2094967/excel-pmt-function-in-js) – J. Chomel Jun 10 '16 at 14:40

1 Answers1

1

My mistake!

I was doing a negative on the PMT function instead of doing the negative on the PV (present value).

var payment = pmt(interest / 12, 60, -(present), future, beginning);
DT.DTDG
  • 765
  • 1
  • 13
  • 31