I have a .xlsx file with 6 sheet that I load with
$objPHPExcel = PHPExcel_IOFactory::load('./FINAL SEB.xlsx');
When I want to get a calculated value from a cell I get a wrong value. This cell have a formula
(IF(COMPARATEUR!B6=20,EMPRUNT20ANS!F32,IF(COMPARATEUR!B6=25,EMPRUNT25ANS!F37,IF(COMPARATEUR!B6=15,EMPRUNT15ANS!F27,"Erreur années"))))-B35
In my PHP code I do
echo $worksheet->getCell('B38')->getCalculatedValue().'<br />';
When I debbuging I obtain
Formula Value is=(IF(COMPARATEUR!B6=20,EMPRUNT20ANS!F32,IF(COMPARATEUR!B6=25,EMPRUNTANS!F37,IF(COMPARATEUR!B6=15,EMPRUNT15ANS!F27,"Erreur années"))))-B35
Expected Value is 59045.580877165
Parser Stack :-
array (size=21)
0 =>
array (size=3)
'type' => string 'Cell Reference' (length=14)
'value' => string 'COMPARATEUR!B6' (length=14)
'reference' => string 'COMPARATEUR!B6' (length=14)
1 =>
array (size=3)
'type' => string 'Value' (length=5)
'value' => int 20
'reference' => null
2 =>
array (size=3)
'type' => string 'Binary Operator' (length=15)
'value' => string '=' (length=1)
'reference' => null
3 =>
array (size=3)
'type' => string 'Cell Reference' (length=14)
'value' => string 'EMPRUNT20ANS!F32' (length=16)
'reference' => string 'EMPRUNT20ANS!F32' (length=16)
4 =>
array (size=3)
'type' => string 'Cell Reference' (length=14)
'value' => string 'COMPARATEUR!B6' (length=14)
'reference' => string 'COMPARATEUR!B6' (length=14)
5 =>
array (size=3)
'type' => string 'Value' (length=5)
'value' => int 25
'reference' => null
6 =>
array (size=3)
'type' => string 'Binary Operator' (length=15)
'value' => string '=' (length=1)
'reference' => null
7 =>
array (size=3)
'type' => string 'Cell Reference' (length=14)
'value' => string 'EMPRUNTANS!F37' (length=14)
'reference' => string 'EMPRUNTANS!F37' (length=14)
8 =>
array (size=3)
'type' => string 'Cell Reference' (length=14)
'value' => string 'COMPARATEUR!B6' (length=14)
'reference' => string 'COMPARATEUR!B6' (length=14)
9 =>
array (size=3)
'type' => string 'Value' (length=5)
'value' => int 15
'reference' => null
10 =>
array (size=3)
'type' => string 'Binary Operator' (length=15)
'value' => string '=' (length=1)
'reference' => null
11 =>
array (size=3)
'type' => string 'Cell Reference' (length=14)
'value' => string 'EMPRUNT15ANS!F27' (length=16)
'reference' => string 'EMPRUNT15ANS!F27' (length=16)
12 =>
array (size=3)
'type' => string 'Value' (length=5)
'value' => string '"Erreur années"' (length=16)
'reference' => null
13 =>
array (size=3)
'type' => string 'Operand Count for Function IF()' (length=31)
'value' => int 3
'reference' => null
14 =>
array (size=3)
'type' => string 'Function' (length=8)
'value' => string 'IF(' (length=3)
'reference' => null
15 =>
array (size=3)
'type' => string 'Operand Count for Function IF()' (length=31)
'value' => int 3
'reference' => null
16 =>
array (size=3)
'type' => string 'Function' (length=8)
'value' => string 'IF(' (length=3)
'reference' => null
17 =>
array (size=3)
'type' => string 'Operand Count for Function IF()' (length=31)
'value' => int 3
'reference' => null
18 =>
array (size=3)
'type' => string 'Function' (length=8)
'value' => string 'IF(' (length=3)
'reference' => null
19 =>
array (size=3)
'type' => string 'Cell Reference' (length=14)
'value' => string 'B35' (length=3)
'reference' => string 'B35' (length=3)
20 =>
array (size=3)
'type' => string 'Binary Operator' (length=15)
'value' => string '-' (length=1)
'reference' => null
Calculated Value is 9860500
Evaluation Log:
null
Can you help me please ?
P.S. Sorry for my english.