The Phantom Formula (Please Help)

Topics: Developer Forum, User Forum
Jul 19, 2012 at 4:12 PM
Edited Jul 19, 2012 at 4:22 PM

Requirements: I am using PHP5, the latest version of PHPExcel(just downloaded), Excel5, Excel2007.

Hello, I'm very new to PHPExcel and after being stuck for a couple of days and scouring forums I have still not found a solution to my problem.

Backstory: I am generating a spreadsheet through PHP using PHPExcel, and everything works perfectly fine when I input formulae or just letters into cells. As an example, here is an iteration I have done that populates a part my excel sheet, where the bold is the part I am having trouble with:

while ($row=mysqli_fetch_array($result)) {
 $acell='A'.strval($c+4);
        $bcell='B'.strval($c+4);
        $ccell='C'.strval($c+4);
        $dcell='D'.strval($c+4);
        $ecell='E'.strval($c+4);
        $objPHPExcel->getActiveSheet()->setCellValue($acell,'=$B$1');
        $objPHPExcel->getActiveSheet()->setCellValue($bcell,$row['task_name']);                        $objPHPExcel->getActiveSheet()->setCellValue($ccell,$row['project_name']);
        $objPHPExcel->getActiveSheet()->setCellValue($dcell,$row['HOURS']);
        $objPHPExcel->getActiveSheet()->setCellValue($ecell,'=IF(IFERROR('.$dcell.'*$H$3,0),'.$dcell.'*$H$3,0)');
$objPHPExcel->getActiveSheet()->getCell($ecell)->getCalculatedValue();
        $c+=1;
}

 

Now columns A-D work perfectly fine, but the formula in column E, the one that is bolded, does not show up when I generate the excel sheet. When I first open the excel sheet the formula works, as I have the sum of column E at the bottom of the sheet and I can see the formula works perfectly fine, but there ARE NO VALUES in the column...they're phantom values or something because the sum is adding them, but I can not see them nor the formula in the cells. The cells are completely empty. Then once I hit the "Enable Edit" button on the excel sheet, the sum goes away and turns to 0.

I have no idea what is happening, please somebody help me figure out the tale of the Phantom Formula! =(