
The problem started in a very complex worksheet but I reduce it to a very simple but still having the same problem.
PHPExcel is not calculating the formula, but if I change to a simple one (=B3) it works.
The formula returned by getvalue() is
=IF(B3="","",IF(C8="N",IF(ISERR(VALUE(B3)),0,VALUE(B3)),T(B3)))
My code.
require_once dirname(FILE) . '/../phpxl/Classes/PHPExcel.php';
set_include_path(get_include_path() . PATH_SEPARATOR . '/../phpxl/Classes/');
$template = "test.xlsx";
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader>load($template);
$objPHPExcel>getActiveSheet()>getCell('B3')>setValue(8);
$result = $objPHPExcel>getActiveSheet()>getCell('B8')>getCalculatedValue();
$result1 = $objPHPExcel>getActiveSheet()>getCell('B8')>getValue();
echo $result.'<br>';
echo $result1.'<br>';
I'm setting a value of 8 at the B3 cell, doing this in excel calculates the same value at B8.
C8 has an 'N'.
But with phpexcel I always get the value it was saved with (2.1)
Response:
2.1
=IF(B3="","",IF(C8="N",IF(ISERR(VALUE(B3)),0,VALUE(B3)),T(B3)))
Replacing in the excel file the formula at B8 to '=B3' it works perfectly showing the result '8'.
Response:
8
=B3
So I must think that is a problem with the formula.
The functions are quite simple IF, T, VALUE, ISERR.
Any idea to get a workaround to this will be welcome.
Tks


Coordinator
May 8, 2013 at 10:42 PM

Perhaps the fact that the VALUE() function hasn't yet been implemented in PHPExcel has something to do with it: this is documented

