21

I need to create a JavaScript form that does the same calculation as this =PMT() function.

mortgage = 220000
rate= 4.75%
term = 30

The example formula I have is =PMT(4.75%/12,30*12,220000*-1)

What would be the equation for this function? I tried to look up this function but it doesn't explain it very well.

2

1 Answer 1

42

The equation you want is: P = (Pv*R) / [1 - (1 + R)^(-n)]

where

  • P = Monthly Payment
  • Pv = Present Value (starting value of the loan)
  • APR = Annual Percentage Rate
  • R = Periodic Interest Rate = APR/number of interest periods per year
  • n = Total number of interest periods (interest periods per year * number of years)

Using the variables above, the Excel =PMT() function is =PMT(R,n,Pv)

So, for your example where:

  • rate (APR) = 4.75% (making R=4.75%/12 or 0.0475/12)
  • mortgage (Pv) = 220000
  • term (# of years) = 30 (n=30*12 with monthly payments)

The equation becomes:

P = ((220000 * (0.0475/12)) / (1 - ((1 + (0.0475/12))^(-1 * 30 * 12))))

Or, with the original equation shown directly below it for comparison:

P = ((220000 * (0.0475/12)) / (1 - ((1 + (0.0475/12))^(-1 * 30 * 12))))
P =  (  Pv   *     R      ) / (1 - ( 1 +       R    )^(     -n     )
2
  • Which, if anyone is checking, equals $1,147.62416. Commented Jun 27, 2017 at 6:58
  • How can this formula be modified to include a fixed monthly increase in the loan, for example is the loan is a credit card and the user spends $50 per month on the card?
    – ut9081
    Commented Jan 4, 2022 at 10:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .