Jump to content

Savings Coumpound Interest (With Monthly Contribultion)


Skylight_lady

Recommended Posts

Hi Guys,

 

I'm trying to get a monthly contribution added to the saving coumpound interest.

 

The original code i have is:

$IntTotal = ($balance*(pow(1+$Rate,$terms)-1));

 

The above code allows me to calculate the interest total without a monthly contribution added. How do i insert the monthly contribution into that? Is there another way to write this in php?

 

Thanks

Link to comment
Share on other sites

Well, you're not going to get exactly the same without knowing their formula. But, using the formulas at this site, I was able to create a formula that gets a result within about a dollar difference from the site you linked using different combinations of values. The problem is determining exactly when and how they calculate the interest and when they are calculating when the monthly contribution is made. Those determinations will change the interest calculations.

 

$principle = 5000;
$monthly_amt = 200;
$years = 6;
$rate = 3.5;

$periods_per_year = 12;
$periods = $years * $periods_per_year;
$interest = $rate / 100 / $periods_per_year;

$future_value = (pow(( 1 + $interest), $periods) * $principle)
		 + ( $monthly_amt * ( ( pow( (1 + $interest), $periods) - 1) / $interest ) );

echo "Start: $ $principle<br>\n";
echo "Monthly: $ $monthly_amt<br>\n";
echo "Years: $years<br>\n";
echo "Rate: $rate %<br><br>\n";
echo "Total: $ $future_value<br>\n";

Edited by Psycho
Link to comment
Share on other sites

Interesting !! But it's too short of the Growth amount. Ive been using the values:

Balance = 20000

MonthlyAmount = 500

InterestRate = 3

Years = 4

 

The correct formula is as follows:

Year1 = (Balance + (MonthlyAmount * 12)) * InterestRate;

Year2 = (Year1 + (MonthlyAmount * 12)) * InterestRate;

Year3 = (Year2 + (MonthlyAmount * 12)) * InterestRate;

 

The end of year balance, is added to 12 months repayments and multiplied by the interest rate.

 

However, if i used the simple maths it won't correct it. Thereforem a more complicated formula is required like the "pow"

Link to comment
Share on other sites

I don't think you understand how interest is calculated. The formulas you just posted are NOT correct. Interest is not calculated at the end of the year. It is commonly calculated each month, also known as the compounding period. So, if the interest rate is 3% and there are 12 compounding periods for the year, the bank will calculate the interest each month using 1/12th of the interest rate - .25%. Using the formula you have above you are applying the total interest at the end of the year. If that was the case you could simply make a huge deposit on Dec. 30th of each year and get a years worth of interest on it. By the same token, if you have $10,000 in the bank all year and then withdrew it on Dec. 30th you wouldn't get any interest. That is why interest is calculated monthly (typically). But, I think banks actually calculate the interest on the average daily balance. That is why it is important to know WHEN the monthly contribution is added. If it is added at the beginning or the end of the month it will affect the interest amount.

 

The formulas you just posted would only be "partially" correct if the compounding period was yearly - which I have never seen.

 

Calculating the interest for a year would look more like this when written out in long form:

Month1Balance = (StartBalance + MonthlyAmount) * InterestRate

Month2Balance = (Month1Balance + MonthlyAmount) * InterestRate

Month3Balance = (Month2Balance + MonthlyAmount) * InterestRate

etc. . . .

 

But, because of average daily balance is what I think is really used, that would be the case if the monthly contribution is added right after the interest calculation each month.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.