savings, interest, inflation etc...

Hi

this is the parameters i want to use:

Initial investment (a)

deposit per f1 (d) for example 1000 per month

frequency of deposit per year (f1), f1=12 if it is per month

frequency of compound (f2)

interest or growth per year (g)

inflation(i)

years (n)

I would like to find the formula where you can answer the question:

you start with a one time initial investment (i) of 5000$ and then you add 1000$ (d) per month (f) for 8 years (n).

the growth or interest is 7% (g) per year (f2) and the inflation 3%.

the calculations are similar to this one, but also includes initial investment.

interest - Wolfram|Alpha

I've come up with an easier version, not including initial investment or f2 (it only works for annual compounding of g).

It looks like this:

(d(1+((g-i)/f)^(fn)-1)/((g-i)/f)

this one is a bit simplified though. I dont know how to do it(Headbang). ive been looking around for instance here:

Time value of money - Wikipedia, the free encyclopedia

but have not yet found the correct formula. Please help

/TT