Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:19:00+00:00 2026-05-31T04:19:00+00:00

I have got a problem with PHPExcel as below function function Test($a, $b) {

  • 0

I have got a problem with PHPExcel as below function

function Test($a, $b) {

    //  Create a new PHPExcel object with a single sheet
    $objPHPExcel = new PHPExcel();
    $activeSheet = $objPHPExcel->getActiveSheet();

    $activeSheet->SetCellValue('B2',$a);
    $activeSheet->SetCellValue('B3',$b);
    $activeSheet->SetCellValue('C4',"=B2+B3");
    $C4 = $activeSheet ->getCell('C4')->getCalculatedValue();

    echo "C4:$C4<br/>";
}

Finally, I call this function

Test(10, 20);
Test(40, 70);
Test(30, 80);

but, result is

C4:30
C4:30
C4:30 

Why getCalculatedValue() DOESN’T change result? It seems like this function only gets the first value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:19:02+00:00Added an answer on May 31, 2026 at 4:19 am

    You can change the result, but for performance reasons the calculation engine caches the result of a formula calculation once it’s been calculated. If you want to change the underlying data, you have to flush that cache before requesting the calculated value again:

    PHPExcel_Calculation::getInstance()->clearCalculationCache();
    

    or

    PHPExcel_Calculation::flushInstance();
    

    You can also change this default behaviour – so that results are not cached at all – before issuing any other requests to the calculation engine:

    PHPExcel_Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a problem with calling a global function, which takes a pointer
i have got a problem with my SQL Statement: Table structure: CREATE TABLE tags
I have got a problem with Java serialization. Suppose I had one Object persisted
I have got a problem with registering user. AttributeError at /users/register/ 'WSGIRequest' object has
I have got a problem about running codedui test which was generated from manual
I am new to XML & XSLT but have got this problem. I have
I have got a problem with two tables: CREATE TABLE IF NOT EXISTS `addresses`
I have got a problem on casting an object to one of it's base
I have got the following problem since the server has safe mode turned on,
I have got a strange problem about in_array recently which I cannot understand. e.g.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.