[Webinar] Learn how to a build a cloud-first strategyRegister Now


Converting EXCELL SUM into PHP

Posted on 2011-10-11
Medium Priority
Last Modified: 2012-08-13
Hi All,

I have two excell sums that I'm trying to  replicate in PHP:

they are:

A.   =SUM(150000*(1+0.06)^25)        outputs = 643780.608

B.     =SUM(80000+(150000*0.09^25))*(1+0.06)^25           outputs  = 343349.6576

I've attempted [A] using the following:

$v1 = (150000*(1+0.06));
$v2 = pow($v1,25);

$v2 ouputs = 1.0837474984052E+130

Not sure where im going wrong so if someone could help me replicate those two SUM that would be great.

Question by:CurtinProp
LVL 15

Assisted Solution

by:Minh Võ Công
Minh Võ Công earned 400 total points
ID: 36947155
$v1 = SUM(80000+(150000*0.09^25));
$v2 = $v1*pow((1+0.06),25);
LVL 10

Expert Comment

ID: 36947179
yeah, minhvc is right.
What you wrote in the first line differs much from what you reproduced in PHP...
LVL 43

Accepted Solution

Saqib Husain, Syed earned 1600 total points
ID: 36947204
Or simply

$v1 = 150000*pow(1+0.06,25);

in one step

Author Comment

ID: 36947529

ssagibh's response was spot on and also was the basis for replicating the other SUM.

So SUM A. in PHP was:


Based on that I converted B. to:


Thanks very much for the help guys.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question