Summary!C2 -> Formula Error: An unexpected error occured

Topics: Developer Forum, Project Management Forum, User Forum
Feb 15, 2011 at 3:51 PM
Edited Feb 15, 2011 at 3:52 PM

Hi, i tried to add the below formula 

$objPHPexcel->getActiveSheet()->setCellValue("C2",'=COUNTIF($"02.01.11".$B$1:$B$300;A3)');

but the following error is occur. 


Exception: Summary!C2 -> Formula Error: An unexpected error occured in C:\wamp\www\PHPExcel\Cell.php on line 284

Please help me to solve this issue.

Note: Im using PHPExcel1.7.5

Coordinator
Feb 15, 2011 at 9:49 PM

Please try this with the latest SVN version... this problem should already have been fixed.

Feb 16, 2011 at 6:23 AM

I took latest SVN version only. but the same problem only occurred.

Exception: Simple!C1 -> Formula Error: An unexpected error occured

Please help me to solve the issue.

/** PHPExcel */

require_once 'PHPExcel.php';
// Create new PHPExcel

object$objPHPExcel = new PHPExcel();
// Add some data

$objPHPExcel->setActiveSheetIndex(0)            ->setCellValue('A1', 'Hello')            ->setCellValue('B1', 'Hello') ->setCellValue('B2', 'Hello') ->setCellValue('B3', 'Hello') ->setCellValue('B4', 'Hello') ->setCellValue('B5', 'Hello') ->setCellValue('B6', 'Hello')            ->setCellValue('C1', '=COUNTIF($B$1:$B$300;A1)');
// Rename sheet

$objPHPExcel->getActiveSheet()->setTitle('Simple');

// Set active sheet index to the first sheet, so Excel opens this as the first sheet

$objPHPExcel->setActiveSheetIndex(0);



$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');

$objWriter->save('simple.xls');

exit;

Coordinator
Feb 16, 2011 at 9:03 AM

Try using a comma (,) rather than a semi-colon (;) as the argument separator.

=COUNTIF($B$1:$B$300,A1)

rather than

=COUNTIF($B$1:$B$300;A1)

Unless you've set a locale, PHPExcel uses en_us (English language function/constant names, and a comma argument separator for functions) for formulae