Bug 15038

Summary: #VALUE! Result from Formula in spreadsheet
Product: POI Reporter: Greg Garson <greggarson>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P3    
Version: 2.0-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Greg Garson 2002-12-03 23:15:16 UTC
I'm getting the #VALUE! result in a spreadsheet from the following code:

HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("New Sheet");
HSSFRow row = sheet.createRow((short)0);
HSSFCell cell1 = row.createCell((short)0);
cell1.setCellValue(1);
HSSFCell cell2 = row.createCell((short)1);
cell2.setCellValue(2);
HSSFCell cell3 = row.createCell((short)2);
cell3.setCellValue(3);
SheetReferences sRef = new SheetReferences();
sRef.addSheetReference("First Sheet", 0);
HSSFCell cell4 = row.createCell((short)3);
cell4.setCellType(HSSFCell.CELL_TYPE_FORMULA);
Ptg[] ref = new Ptg[5];
ref[0] = new AreaPtg("A1:B1");
ref[1] = new IntPtg("1");
ref[2] = new FuncVarPtg("LARGE", (byte)2);
ref[3] = new ReferencePtg("C1");
ref[4] = new AddPtg();
cell4.setCellFormula(FormulaParser.toFormulaString(sRef, ref));
FileOutputStream fileOut = new FileOutputStream("testWorkBook1.xls");
wb.write(fileOut);
fileOut.close();

Have also tried entering this straight into setCellFormula as "LARGE(A1:B1,1)
+C1" returning the same effect.  Is LARGE an unsupported 'array formula' as 
specified under formula support?
Comment 1 Andy Oliver 2003-07-24 13:59:19 UTC
Thats not how you use formulas.