My knowledge on math/terminology is pretty terrible so seeking some help with a formula (which I'll be converting to javascript to be used in a calculator).
I'm trying to calculate the total amount paid over X years, with each year compounded up by an escalation percentage.
For example,
Yearly Payments = $£24,000$
Yearly Escalation = $3.5$%
Payment Length = $7.373$ years
I've been digging many many similar questions, but none match my scenario.
Any help would be appreciated.
$\endgroup$ 72 Answers
$\begingroup$Here is the formula for regular deposit
$Amount = \frac{D\times[(1+r)^t-1]}{r}$
The total amount after 7.373 years if deposit 24,000 per year with the yearly interest rate = 3.5% and compounded yearly will be
$\frac{24000\times[(1+0.035)^{7.373}-1]}{0.035}$
You may finish the calculation.
$\endgroup$ $\begingroup$The following derivation assumes a starting salary $x$ compounds according to certain interest rate $p$ each year, with the amount earned right after the first year being $(1+p)x$. Next, during any given year, an employee is paid $m$ times in equal payments which add up to the total salary for that year. You are asking for the total amount $A$ that the employee has earned after $N$ years, where $N$ need not be a whole number.
The strategy I used to find the formula was to calculate the amount earned after $\lfloor N \rfloor$ years, and then the amount earned during the remaining time, which is part of the $(\lfloor N \rfloor + 1)^\text{th}$ year.
The notation I use is $\lfloor \cdot \rfloor$ for the floor function, and $[\cdot]$ for the integer part of a number. You may be familiar with these from your programming experience.
We first calculate the amount earned after $\lfloor N \rfloor$ years. As was shown in your link, the amount earned $A$ after the first year is $$A(1) = (1+p)\cdot x.$$ After 2 years, it is $$A(2) = (1+p)\cdot x + (1+p)\cdot(1+p)\cdot x.$$ So after $\lfloor N \rfloor$ years, it is $$A(\lfloor N \rfloor) = (1+p)\cdot x + \dots + (1+p)^{\lfloor N \rfloor} \cdot x = (1+p)\sum_{k=1}^{\lfloor N \rfloor}(1+p)^{k-1}x.$$ Using the formula for the partial sum of a geometric progression, this can be simplified to $$A(\lfloor N \rfloor) = (1+p)\frac{(1+p)^{\lfloor N \rfloor}-1}{p}x. $$
Then, we calculate the amount that the employee earns during the remaining time. In your question, this is $0.373$ of the $8^{\text{th}}$ year. The amount earned from one payment in the $(\lfloor N \rfloor + 1)^{\text{th}}$ year is $$\frac{1}{m} (1+p)^{\lfloor N \rfloor + 1}x.$$
The number of times $k$ that the employee gets paid in the $(\lfloor N \rfloor + 1)^\text{th}$ year is $$k = \text{floor}\left(\frac{N - \left[N\right]}{\frac{1}{m}}\right) = \lfloor m(N -[N]) \rfloor.$$ So, the amount earned in the $(\lfloor N \rfloor + 1)^\text{th}$ year is $$\left(\frac{1}{m}\left(1+p\right)^{\lfloor N \rfloor + 1}x \right)k.$$ The total amount earned after $N$ years is then $$A(N) = A(\lfloor N \rfloor) + \frac{1}{m}\left(1+p\right)^{\lfloor N \rfloor + 1}kx,$$ which ends up as $$A(N) = (1+p)\frac{(1+p)^{\lfloor N \rfloor}-1}{p} x+ \frac{1}{m}\left(1+p\right)^{\lfloor N\rfloor + 1}x\lfloor m(N -[N]) \rfloor.$$
For example, in your question, you specify $x = 24000$, $p = 0.035$, $N = 7.343$. Lets say employees get payed bi-weekly, so they get payed $26$ times a year. I.e., $m = 26$. Then the amount earned after $7.343$ years is $A(7.343) = (1.035)\cdot\frac{((1.035)^7-1)\cdot 24000}{0.035} + \frac{1}{26}(1.035)^8 \cdot 24000 \cdot \lfloor 26 \cdot 0.343 \rfloor \approx 202965.$ I checked the case $N=7$ and it is consistent with the sum of the "Salary" column in your link.
I am not sure whether or not this is what you're after, but I hope it gives some insight as to how you can come up with formulas in situations like these. If you need to make some minor adjustments to the formula, such as having the salary just after the first year being $x$ instead of $(p+1)x$, you can use a similar argument as above, just change $A(1)$ and go from there.
$\endgroup$