# Formula for compound interest with N withdrawals

I have a calculator that allows users to see how much they need to save per period (month, year, etc) when putting money into a savings account. There are N withdrawals made in the end, with N ranging from 1 to 9, and years ranging from 1 to 22 (making periods range from 1 to 12*22=264). Each withdrawal is made in one period. For example:

Year      : 1  2  3  4  5  6  7
Withdrawal: 0  0  0  0  7  7  9

Users input how much what they're saving for costs now, how much the interest rate on that cost is, the rate their investment will grow, and for how many years they'll be saving. The calculator outputs how much they should save per period.

I am trying to allow for a lump-sum investment though. Setting the period to 1 in the calculator does not output a correct answer. Is there a formula that anyone knows off-hand for this?

To be clear: with the inputs described above, I am looking for the output of what the initial investment amount should

-------------EDIT------------

Example input:

years: 4
# of withdrawals: 2
goal (sum of withdrawals): $22,601 interest rate: 0.06 (6%) I need it to output the following: lump sum deposit:$19,454
• Do you want to know what they should be investing now so that it's possible to make the specified withdrawals in the future? Jan 23 '14 at 16:37
• Yes, basically. The withdrawals aren't specified--they are calculated based on other parameters not listed, but for the sake of the formula you can assume that. Jan 23 '14 at 16:47
• Your example does not seem to have a single deposit at the start as your question describes. One deposit of $6893$ can't give you $22601$ output in any reasonable number of year. You say there are two withdrawals, but don't say when they come out. Somehow it is encoded in 5 years and two withdrawals. Jan 23 '14 at 17:12
• The example I gave was a working annual deposit example. The reason I posted it was so that I could reference it in the comment I made in your answer. Jan 23 '14 at 17:16
• You asked about a single initial deposit, which is what I answered. I don't know what this has to do with it, and your comment doesn't seem to refer to it. Jan 23 '14 at 17:23

You can just discount each of the desired withdrawals. If the initial deposit is at the start of year 1, the withdrawals are at the ends of the years indicated, and the annual interest is $i$, to get that withdrawal of $7$ at year $5$ requires $\frac 7{(1+i)^5}$. To get your whole stream, you must deposit $\frac 7{(1+i)^5}+\frac 7{(1+i)^6}+\frac 9{(1+i)^7}$ at the start. Here is a table showing that $16.15105$ is sufficient $$\begin {array}\ Year&Flow, end of year&Balance, end of year\\0&16.15104502&16.15104502\\1&&17.12010772\\2&&18.14731418\\3&&19.23615303\\4&&20.39032221\\5&-7&14.61374155\\6&-7&8.490566038\\7&-9&0 \end {array}$$
• Using your formula, the output was an initial deposit of \$19,560, and the final balance I had was \$35. This is using the same inputs as I had in the example I just added. Jan 23 '14 at 17:14
• At $i=0.06$, I get an initial deposit of $16.15105$ and it comes out even nicely with withdrawals of $7$ in year $5$, $7$ in year $6$ and $9$ in year $7$ Jan 23 '14 at 17:19