Rukikun Rukikun - 1 year ago 189
PHP Question

Getting formula from another sheet PHPExcel

I'm having trouble in executing my formula using PHPexcel. I'm getting my formula from another sheet which name is Sample New Report. Although there are no errors when I run it but for some reason after the program is executed; it returns an error saying Undefined variable A. Can you help me in getting my formula running?

Here's my formula code:

$rowCount2 = 4;
$objPHPExcel->getActiveSheet()->setCellValue('B'.$rowCount2,
"=SUMIF('Sample New Report'!$A:$A,Incentive!$A4,'Sample New Report'!$Z:$Z)");

Answer Source

This isn't anything to do with other sheets: PHPExcel does not support formulae using row (2:2) or column (A:A) references, whether in the same worksheet or in another worksheet. Use ranges instead

=SUMIF('Sample New Report'!$A1:$A1024,Incentive!$A4,'Sample New Report'!$Z1:$Z1024)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download