Converting EXCELL SUM into PHP

Posted on 2011-10-11
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
    $v1 = SUM(80000+(150000*0.09^25));
    $v2 = $v1*pow((1+0.06),25);
    LVL 10

    Expert Comment

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

    Accepted Solution

    Or simply

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

    in one step
    LVL 2

    Author Comment


    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

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    The viewer will learn how to count occurrences of each item in an array.
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now