I got same error with:

SUBTOTAL(9,B:B)

but not with

SUBTOTAL(9,B1:B10)

so I guess it has to do with the column references...
 

> -----Original Message-----
> From: Samuel R. Neff [mailto:[EMAIL PROTECTED] 
> Sent: Monday, August 23, 2004 1:29 AM
> To: [EMAIL PROTECTED]
> Subject: StringIndexOutOfBoundsException when setting a formula
> 
> 
> I'm just starting out with POI and am trying to create a 
> workbook that has
> three worksheets--Salespeople, Categories, Raw Data.  The Raw 
> Data is a
> basic dump of the data and the Salespeople and Categories 
> sheets each use
> formulas to create a summary (aggregation) of data.
> 
> The Raw Data sheet is as follows:
> 
> 3 columns, 
> 
> A: Salesperson
> B: Category
> C: Sales Amount
> 
> Category Sheet:
> 
> A: Category
> B: Sales Amount
> 
> Salespeople Sheet:
> 
> A: Salesperson
> B: Sales Amount
> 
> When I try to create the Category Sheet, I guess this error:
> 
> java.lang.StringIndexOutOfBoundsException: String index out 
> of range: 0
>       at java.lang.String.charAt(Unknown Source)
>       at
> org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:44)
>       at
> org.apache.poi.hssf.util.AreaReference.<init>(AreaReference.java:33)
>       at
> org.apache.poi.hssf.record.formula.Area3DPtg.setArea(Area3DPtg
> .java:243)
>       at
> org.apache.poi.hssf.record.formula.Area3DPtg.<init>(Area3DPtg.java:58)
>       at
> org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:280)
>       at
> org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:474)
>       at
> org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:548)
>       at
> org.apache.poi.hssf.model.FormulaParser.Expression(FormulaPars
> er.java:596)
>       at
> org.apache.poi.hssf.model.FormulaParser.Arguments(FormulaParse
> r.java:443)
>       at
> org.apache.poi.hssf.model.FormulaParser.function(FormulaParser
> .java:315)
>       at
> org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:265)
>       at
> org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:474)
>       at
> org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:548)
>       at
> org.apache.poi.hssf.model.FormulaParser.Expression(FormulaPars
> er.java:596)
>       at
> org.apache.poi.hssf.model.FormulaParser.parse(FormulaParser.java:700)
>       at
> org.apache.poi.hssf.usermodel.HSSFCell.setCellFormula(HSSFCell
> .java:678)
> 
> The Formula is:
> 
> SUMIF('Raw Data'!B:C,A3,'Raw Data'!C:C)
> 
> Which is copied directly from Excel.
> 
> Seems to be a bug in the formula parser.  Is there any way to 
> work around
> this bug?  I can pre-calculate and hard-code the data but I'd 
> rather use
> formulas so the data updates when changed.
> 
> I didn't file a bug as I don't have a bugzilla account.
> 
> Thanks,
> 
> Sam
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to