https://issues.apache.org/bugzilla/show_bug.cgi?id=50209

           Summary: Evaluation of SUBTOTAL function seems to be incorrect
           Product: POI
           Version: 3.7
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created an attachment (id=26253)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26253)
sample spreadsheet

Sample spreadsheet:
    A1: 1
    A2: =SUBTOTAL(9,A1)
    A3: =SUBTOTAL(9,A1:A2)

Sample code;
    Workbook wb = WorkbookFactory.create(new FileInputStream("subtotal.xlsx"));
    FormulaEvaluator eval = wb.getCreationHelper().createFormulaEvaluator();
    eval.evaluateFormulaCell(wb.getSheetAt(0).getRow(2).getCell(0));
    FileOutputStream fout = new FileOutputStream("subtotal_output.xlsx");
    wb.write(fout);
    fout.close();

If you execute this sample code, you will get subtotal_output.xlsx.
When opening this file in Excel 2007, you will get next spreadsheet.
    A1: 1
    A2: 1
    A3: 2

Correctly, cell A3 should be 1.
It seems that the cell containing SUBTOTAL (A2) is summed up while evaluating
SUBTOTAL in A3, though it should be ignored.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to