PHPExcel_Calculation_Exception thrown on formula

Topics: Developer Forum
Nov 14, 2013 at 3:10 AM
CentOS 6, php5.3.3 PHPExcel1.7.9
When this formula is set:

$Allocation->getActiveSheet()->setCellValue("C5", "Ticker")->setCellValue("D5", "Class")
    ->setCellValue("E5", "=IF(OR(E4<0,E4>80),'RangeErr','')");
The formula works directly in both excel as is and OO by changing the , to ;
If setting setPreCalculateFormulas(FALSE) it shows as unreadable content in Excel. OO shows the formula text, but it is text not formula.

This exception is thrown.

Fatal error: Uncaught exception 'PHPExcel_Calculation_Exception' with message 'Worksheet!E5 -> Formula Error: An unexpected error occured' in /home/hewdavid/Shared/Classes/PHPExcel/Cell.php:298
Stack trace:

0 /home/hewdavid/Shared/Classes/PHPExcel/Writer/Excel2007/Worksheet.php(1078): PHPExcel_Cell->getCalculatedValue()

1 /home/hewdavid/Shared/Classes/PHPExcel/Writer/Excel2007/Worksheet.php(1025): PHPExcel_Writer_Excel2007_Worksheet->_writeCell(Object(PHPExcel_Shared_XMLWriter), Object(PHPExcel_Worksheet), 'E5', Array, Array)

2 /home/hewdavid/Shared/Classes/PHPExcel/Writer/Excel2007/Worksheet.php(83): PHPExcel_Writer_Excel2007_Worksheet->_writeSheetData(Object(PHPExcel_Shared_XMLWriter), Object(PHPExcel_Worksheet), Array)

3 /home/hewdavid/Shared/Classes/PHPExcel/Writer/Excel2007.php(253): PHPExcel_Writer_Excel2007_Worksheet->writeWorksheet(Object(PHPExcel_Worksheet), Array, false)

4 /home/hewdavid/4kadv/webuildyoua_com/htdocs/new_xls1.php(293): PHPExcel_Writer_Excel2007->save('php://output')

5 {main}

thrown in /home/hewdavid/Shared/Classes/PHPExcel/Cell.php on line 298