https://bz.apache.org/bugzilla/show_bug.cgi?id=62875

            Bug ID: 62875
           Summary: Area with empty cell is shifted
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: p...@table2web.de
  Target Milestone: ---

Created attachment 36227
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36227&action=edit
MDETERM function with empty cell in referenced area

Hi,

the behavior of function MDETERM with at least one empty cell in the
area-parameter differs between POI and Excel/LibreOffice (both tested).

In an Excel 365 file there are the following functions/values:
- A1: =MDETERM(A2:B3)
- A2: [empty]
- B2: 1
- A3: 1
- B3: 1

Excel 365 and LibreOffice 6.1.2.1 both show "#VALUE" in A1 for that situation.
POI asserts A2 = 0 and returns A1 = -1.

This A2=0 comes from
org.apache.poi.ss.formula.functions.MatrixFunction.OneArrayArg.evaluate(int,
int, ValueEval). There the collectValues(arg0)-call collects the values for the
given area A2:B3 and returns values[]={1.0,1.0,1.0} (only 3 of 4 values).
The subsequent call of fillDoubleArray(...) creates a "double[][] matrix"-array
that is initialized with zeros. fillDoubleArray(...) returns matrix[][]=[[1.0,
1.0], [1.0, 0.0]].
Thus matrix does not represent the actual matrix from the workbook, but a
shifted version with a false 0-value.

A solution could be that collectValues() throws an EvaluationException for any
empty cell in that area.
Another solution could be that collectValues() returns a Double[][] array with
null values so that subsequent methods can determine whether they throw an
exception.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to