Thread

Posted on Thu Apr 21 15:38:49 2005 by marfolarfo
Help needed with repeat_formula
I am trying to put the following formula into a cell using the repeat_formula function =IF(OR(ISBLANK(B12),ISBLANK(B11)),0,(B12-B11+IF(B12<B11,1))) I am storing the formula like this $intervalFormula = $worksheet->store_formula('=IF(OR(ISBLANK(B4),ISBLANK(B3)),0,(B4 - B3 + IF(B4<B3 +,1)))'); The repeat_formula call looks like this. $worksheet->repeat_formula($i - 1, $intervalColumn, $intervalFormula, $numFormat, (B4=>'B'. $i,B3=> +'B' . ($i - 1), B4=>'B'. $i,B3=>'B' . ($i - 1), B4=>'B'. $i, B3=>'B' . ($i - 1))); I get the following error when i = 305. Row B3040405 greater than 65536 in formula If I use this repeat_formula call, it works OK except that not all the cell variables are substitut +ed. As soon as I add three or more items to substitute, it failes. $worksheet->repeat_formula($i - 1, $intervalColumn, $intervalFormula, $numFormat, (B4=>'B'. $i,B3=> +'B' . ($i - 1) )); Any ideas what I am doing wrong or is this a bug in repeat_formula?
Direct Responses: 367 | Write a response
Posted on Thu Apr 21 17:35:50 2005 by jmcnamara in response to 366
Re: Help needed with repeat_formula

You are encountering repeated substitutions on one variable due to a false match. Consider the following:

$str = 'B305; $str =~ s/B3/B304/; # $str is now B30405 $str =~ s/B3/B304/; # $str is now B3040405

See the repeat_formula() section of the documentation. In particular the part starting from "You should also be careful to avoid false matches". This suggests how to avoid this error.

John.
--
Write a response