PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » Spreadsheet_Excel_Writer » Bug #6318

Error found in valid excel formula

Details

Submitted2005-12-21 22:12 UTC
Fromjon dot bertsch at ucop dot edu
StatusNo Feedback
PackageSpreadsheet_Excel_Writer
PHP Version5.0.4
OSLinux SUSE 9.2
Roadmaps(Not assigned)

Comments

[2005-12-21 22:12 UTC] jon dot bertsch at ucop dot edu

Description:
------------
I get an error with the following formula:

VLOOKUP(C22,'Stip rates'!$B$3:$C$69,2)

SEW is giving back:
Syntax error: , lookahead: , current char: 12

Test script:
---------------
The error is coming out of parser.php in function _fact() because the , after first cell is being sent on for some reason. This formula works in a normal excel sheet.

[2005-12-22 18:48 UTC] jon dot bertsch at ucop dot edu

Added comment:
I forgot to add that the error shows up whether the $ in the
formula are escaped or substituted by thier hex code.

I've tried to debug where the problem occurs but I can't
determine whether it's in _advance() or further down the
chain . If I remove the $ in the formula then the particular
error disappears. What is happening is that the comma
between the first two variables on VLOOKUP is being passed
on to _condition() (which doesn't happen with other formulas
I tested).

Thanks

[2007-03-02 19:13 UTC] luke at pgtv dot com

I am also getting an error with a formula.

Granted, this may be my fault, since it is a long formula and therefore easy to mess up. But regardless:

=IF(FORECAST($A2146+120,D2112:D2146,$A2112:$A2146)>AVERAGE(D2112:D2146)*1.1,FORECAST($A2146+120,D2112:D2146,$A2112:A2146),AVERAGE(D2112:D2146)*1.1)

is the formula. I am generating it by the following code:

$formula_avgul = "=IF(FORECAST(\$A". $hostnameEndRow ."+" .$forecast_days .",D" . $hostnameStartRow . ":D" . $hostnameEndRow;
$formula_avgul .= ",\$A" . $hostnameStartRow .":\$A" . $hostnameEndRow .")>AVERAGE(D" . $hostnameStartRow .":D";
$formula_avgul .= $hostnameEndRow . ")*1.1,FORECAST(\$A" . $hostnameEndRow . "+" . $forecast_days .",D";
$formula_avgul .= $hostnameStartRow . ":D" . $hostnameEndRow . ",\$A" . $hostnameStartRow .":A" . $hostnameEndRow ."),";
$formula_avgul .= "AVERAGE(D" . $hostnameStartRow . ":D" . $hostnameEndRow . ")*1.1)";

$worksheet->writeFormula($writerow, 3, $formula_avgul);

I echoed it to a shell and the $formula_avgul was spit back fine..but when it got written into the excel file it came back as:
Syntax error: ,, lookahead: , current char: 29

Everything else is working fine.