Hi guys,
Not sure if anyone can help with this one, ive been trying to use phpexcel to produce a spread sheet based on the information stored in my database… Everything seems to work well except when i try to add a formula to the spread sheet. Im trying to add the formula in a while loop s that each row containing data will also have a formula but im not sure how i should be typing the formula.
Here is the code in question…
$row = 6;
while($d = mysql_fetch_array($query)){
$id = $row-1;
$rate = $d['pay_rate'];
$objPHPExcel->getActiveSheet()->setCellValue('C' . $row, $d['name']);
$objPHPExcel->getActiveSheet()->setCellValue('E'.$row, '=I'.$row);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $row, $rate);
$objPHPExcel->getActiveSheet()->setCellValue('G6', '=IF(F6=4.92,0.53,0)+IF(F6=5.93,0.64,0)');
$objPHPExcel->getActiveSheet()->setCellValue('H6', '=SUM(E6*F6)+E6*G6');
$objPHPExcel->getActiveSheet()->setCellValue('I' . $row, $d['sum_hours']);
$row++;
}
G6 and H6 is where im stuck. I want something like…
$objPHPExcel->getActiveSheet()->setCellValue('G', '=IF(F$row=4.92,0.53,0)+IF(F$row=5.93,0.64,0)');
If anyone has any ideas i would be great-full for the help