1

I am using PHPExcel (http://phpexcel.codeplex.com/, https://github.com/PHPOffice/PHPExcel)

I have to use array function for my calculations in Excel. For example:

=SUM(IF(D4:D7+G4:G7,1,0))

If I would write the formula manually I should press Ctrl+Shift+Enter when I finish writing the formula.

If I set the value using the following code:

$sheet->setCellValueByColumnAndRow(2,10,"=SUM(IF(D4:D7+G4:G7, 1, 0))");

I get the #VALUE! in B10 cell, because Ctrl+Shift+Enter wasn't press to set the formula to be array formula.

What is the way to do it with PHPExcel? I tried even to set:

$sheet->setCellValueByColumnAndRow(2,10,"{=SUM(IF(D4:D7+G4:G7,1,0))}");

but it doesn't help (it prints the formula as a text {=SUM(IF(D4:D7+G4:G7,1,0))}).

Thank you!

Remark, I use the current version of PHPExcel I downloaded on 2-July-2013

4

0 回答 0