Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: Error when resolving formulas referencing other worksheets

$
0
0
So I've been working around the issue, and just ran into another, much like the 2nd block above. I have the following (I have sheets named 1-days of the month that I pull the same cell from on each):
for( $i=1;$i<=$daysInMonth;$i++ ) {
    $objPHPExcel->setActiveSheetIndexByName($i);
    echo $objPHPExcel->getActiveSheet()->getCell('D19')->getValue() . "<BR>";
}
and that returns "=SUM(D15+D18)" For every getValue(). I understand this is normal functionality and I'm just using it to illustrate the actual value of the cells. I then change the code to:
for( $i=1;$i<=$daysInMonth;$i++ ) {
    $objPHPExcel->setActiveSheetIndexByName($i);
    echo $objPHPExcel->getActiveSheet()->getCell('D19')->getCalculatedValue() . "<BR>";
}
Which is just swapping out getCalculatedValue() for getValue(). It outputs the first value correctly (because it doesn't reference a different sheet-it's the first of the month), which is 0, and then it errors out giving me:
[Thu Apr 25 01:12:42 2013] [error] [client 10.0.1.4] PHP Fatal error:  Uncaught exception 'PHPExcel_Exception' with message '2!D19 -> 2!D15 -> 2!D13 -> 2!B13 -> undefined variable '!'' in /var/www/Classes/PHPExcel/Cell.php:307
Stack trace:
#0 /var/www/index.php(42): PHPExcel_Cell->getCalculatedValue()
#1 {main}
  thrown in /var/www/Classes/PHPExcel/Cell.php on line 307
For clarity as to the D19 -> D15 -> D13 -> B13 -> undefined, D19 =SUM(D15+D18). D15 =SUM(D13-D14). D13 =SUM(C13-B13)*A15. C13=53454. B13 ='1'!C13. And that's where it errs out. There's got to be something I'm just overlooking

Viewing all articles
Browse latest Browse all 2707

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>