Hi Samuel, In the VBA code section, check the default name of the sheet. It should be the same as the visible name that one sees in the excel window (the tabs at the bottom). I faced some problems because of the mismatch in the two names. Maybe this will help you.
Regards, Rishi Tandon Morgan Stanley | Institutional Securities Mgmt Morgan Stanley Advantage Services Private Limited | Bldg. 5, Sector 30, Mindspace, Goregaon (West) | Floor 02 Mumbai, 400 090 Phone: +91 22 5641-1270 [EMAIL PROTECTED] -----Original Message----- From: Samuel R. Neff [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 10:59 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(FormulaParser.java:59 6) at org.apache.poi.hssf.model.FormulaParser.Arguments(FormulaParser.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(FormulaParser.java:59 6) 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] -------------------------------------------------------- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
