Issue with 'IF' functionality

Jul 9, 2009 at 4:43 PM

http://www.mediafire.com/file/juiughiowy5/referror2.xls

The formula in E6 is: =IF($D6="X","No","Yes")

D6: Formula to another sheet that was originally a zero

D7: 0

D8: X

D9: 1

D43: Formula to another sheet that was originally an X

With this file, in Excel for Mac and Open Office:  E6, E7, E9 all show 'Yes'.  E8, E43, E44 all show 'No'.

With PHPExcel: E9 shows 'Yes', the rest show 'No'.

The behavior of Excel and OO are what I expect to happen

I'm using the latest version in the SVN as of this morning, July 9.

The code I'm using to test with:

<?php
	error_reporting(E_ALL);
    require_once("PHPExcel.php");
	require_once("PHPExcel/Reader/Excel5.php");
	require_once("PHPExcel/Shared/Date.php");

	$excelReader = new PHPExcel_Reader_Excel5();
	$excelReader->setReadDataOnly(true);
	echo "Loading referror2.xls\n";
	$excelDoc = $excelReader->load('referror2.xls');
	$activeWorksheet = $excelDoc->getActiveSheet();
	$value = $activeWorksheet->getCellByColumnAndRow(3,6)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(4,6)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(3,7)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(4,7)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(3,8)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(4,8)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(3,9)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(4,9)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(3,43)->getCalculatedValue();
	var_dump($value);
	$value = $activeWorksheet->getCellByColumnAndRow(4,43)->getCalculatedValue();
	var_dump($value);

Developer
Jul 9, 2009 at 5:34 PM

I'm having problems with the download link, it says I should enter a password. Can you examine that?

Jul 28, 2009 at 1:02 PM

Oh, jeez, sorry.  I never saw your message.  I don't know why it was passworded, but I removed the password and you should be able to download it now.  Thanks for looking at this.

Developer
Jul 28, 2009 at 9:57 PM

I can verify this issue. Seems to be a bug in the calculation engine.

Posted in the issue tracker:

http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10362

If this is urgent, you may consider reading the cached calculated values in the Excel workbook (using latest source code).

Example:

$objPHPExcel->getActiveSheet()->getCell('E7')->getOldCalculatedValue(); 

Jul 29, 2009 at 5:02 PM

Thanks Koyama.  Using the 'getOldCalculatedValue' does work as a workaround for the code I submitted, but my original document still has other issues that I believe are related.  I will look into figuring out how to reproduce the problem with a document I can share.