MOD function with another function does not work #391
Description
The problem is that excel generates a corrupt and will not open.
El problema es que genera un excel corrupto y no se abre.
Código/CODE
$fecha_inicio = 'A2';//celda que contiene la fecha de inicio 26-09-2013
$fecha_fin = 'B2';//celda que contiene la fecha de termino 01-06-2014
$fila_resultado = 'C2'//celda que contendra el resultado
$formula = '=(IF('.$fecha_fin.'="-",0,MOD(('.$fecha_fin.'-'.$fecha_inicio.'),200)))';//no funciona
//en excel se ve asi =(SI(B2="-";0;RESIDUO((B2-A2);200))) y el resultado es 48
//$formula = '=MOD(IF('.$fecha_fin.'="-",0,(('.$fecha_fin.'-'.$fecha_inicio.'))),200)';//no funciona
//$formula = '=MOD(600,365)';//si funciona
$objPHPExcel->getActiveSheet()->setCellValue($fila_resultado, $formula);
Message
Excel can not open the file because the format or the extension of this are invalid, check that the file has not been corrupted and that the extension of it matches the file format
Mensaje
Excel no puede abrir el archivo porque el formato o la extensión de este no son válidos, compruebe que el archivo no se ha dañado y que la extensión del mismo coincide con el formato del archivo