A couple of years ago, in this post I published the formula for calculating loan repayments based on rate, PV, FV and interest rates etc.

I mistakenly said that you couldn’t arrange the formula to give an expression which would calculate the TERM given the other values.

I was wrong.

Here’s the formula:

NPER = LOG((PMT*(1+RATE*TYPE) – RATE * FV) / (PMT*(1+RATE*TYPE) + @RATE*PV)) / LOG(1+RATE)

FV is the “Future Value” of an investment assuming an initial investment (PV), constant repayments (PMT) and a constant interest rate (RATE) over a fixed term of months (NPER). When “TYPE” is zero, loan repayments are made in advance. When “TYPE” is 1, loan repayments are made in arrears.

It yields a non-integer result. The result should be rounded up to the next highest integer, with the value of the final repayment reduced.

If I get time I’ll post a formula for the final repayment later.