PHPExcel not calculating formulas
<p>So im kinda new to phpExcel and im making a sheet with data from a form(not done but will come) but i have a problem my formulas wont calculate i have tested preset formulas and import formulas from the code but none wont work all i get is 0 and protected mode and if i click editsheet and click on the cell where the formula is and hit enter it works and calculate it</p>

<pre><code>&lt;?php
/** Error reporting */
error_reporting(E_ALL);

/** PHPExcel */
include 'Classes/PHPExcel.php';

/** PHPExcel_Writer_Excel2007 */
include 'Classes/PHPExcel/Writer/Excel2007.php';
include 'Classes/PHPExcel/IOFactory.php';



// Load file if it doesn't exists
if (file_exists('Exceltime.xlsx'))
{
    $objPHPExcel = PHPExcel_IOFactory::load('Exceltime.xlsx');
}
else
{
    $objPHPExcel = new PHPExcel();
}



$objPHPExcel-&gt;setActiveSheetIndex(0)
        -&gt;setCellValue('C4', '10:00')
        -&gt;setCellValue('D4', '18:00')
        -&gt;setCellValue('E4', '01:30')
        -&gt;setCellValue('F4', '=(D4-C4-E4)');

$objPHPExcel-&gt;setActiveSheetIndex(0)
        -&gt;setCellValue('C5', '10:00')
        -&gt;setCellValue('D5', '18:00')
        -&gt;setCellValue('E5', '01:30')
        -&gt;setCellValue('F5', '=(D5-C5-E5)');




$objPHPExcel-&gt;getActiveSheet()-&gt;setTitle('TidsRapport Namn');
header('Content-Type: application/vnd.openxmlformats-              officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="Tidsrapport Namn.xlsx"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter-&gt;setPreCalculateFormulas(TRUE);
$objWriter-&gt;save('php://output');
?&gt;
</code></pre>

<p>So all it should do is import work clock hours Start/end/break and then the formula is calculating how many hours/minutes you work</p>

<p>also if there is a better way or something i should do im free to try it :)</p>