I have a cell C13 with a simple test formula =SUMIF(D8:D18,2,E8:E18). D8->D18 Holds 2 2's and the values of D8:D18 are hardcoded, not retrieved from another formula. The range of E8->E18 are all 1's. In excel the correct value is 2. But when i call PHPExcel with the following simple code.
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
PHPExcel_Calculation::getInstance($objPHPExcel)->clearCalculationCache();
$objReader = $objPHPExcel->setActiveSheetIndexByName("TestSumIf");
$value = $objPHPExcel->getActiveSheet()->getCell('C13')->getCalculatedValue();
I get $value = 0.
Formula Value is=SUMIF(D8:D18,2,E8:E18)
Expected Value is 0
Parser Stack :- Array ( [0] => Array ( [type] => Cell Reference [value] => D8 [reference] => D8 ) [1] => Array ( [type] => Cell Reference [value] => D18 [reference] => D18 ) [2] => Array ( [type] => Binary Operator [value] => : [reference] => ) [3] => Array ( [type] => Value [value] => 2 [reference] => ) [4] => Array ( [type] => Cell Reference [value] => E8 [reference] => E8 ) [5] => Array ( [type] => Cell Reference [value] => E18 [reference] => E18 ) [6] => Array ( [type] => Binary Operator [value] => : [reference] => ) [7] => Array ( [type] => Operand Count for Function SUMIF() [value] => 3 [reference] => ) [8] => Array ( [type] => Function [value] => SUMIF( [reference] => ) )
Calculated Value is 0
Evaluation Log:
Anyone have an insight as to why this might be happening. Ive seen the documentation saying there should be no error with SUMIF but only with SUMIFS that can be rewritten as SUMPRODUCT, but in my case SUMIF is causing the error.