https://issues.apache.org/ooo/show_bug.cgi?id=125743
Issue ID: 125743
Issue Type: DEFECT
Summary: INDEX() function in array context returns #VALUE!
cells instead of full rows
Product: Calc
Version: 4.0.1
Hardware: Mac
OS: Mac OSX, all
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: editing
Assignee: [email protected]
Reporter: [email protected]
How to reproduce:
* Open a blank spreadsheet
* In an arbitrary cell, enter this formula:
<tt>=INDEX({1;3;5|7;9;10};{2|1};0;1)</tt>
* Press Command-Shift-Enter to make this formula an array formula.
* The array formula fills three columns by two rows of cells.
Observed behaviour:
Cell contents are <tt>{7; #VALUE!; #VALUE! | 1; #VALUE!; #VALUE}</tt> .
Expected behaviour:
Cell contents are <tt>{7; 9; 10 | 1; 3; 5}</tt> .
Discussion:
The "column" parameter of the INDEX() function is 0. This means that, outside
of an array context, the INDEX function returns all columns of the selected row
of an array.
The "row" parameter of the function is <tt>{2|1}</tt>. I expect that in the
array context, each row of this vector would be applied to the array.
If the formula is modified to have only a scalar value for the "row" parameter,
as in <tt>=INDEX({1;3;5|7;9;10};2;0;1)</tt>, as an array formula, then the
result array is one row by three columns, with the value <tt>{7; 9; 10}</tt>,
as expected.
If the formula is modified to have a nonzero value for the "column" parameter,
as in <tt>=INDEX({1;3;5|7;9;10};{2|1};1;1)</tt>, as an array formula, then the
result array is two rows by one columns, with the value <tt>{7|1}</tt>, as
expected.
If the formula is modified to delete the "column" and "range" parameters, the
observed behaviour is unchanged.
Observed only on OO.o 4.0.1 on Mac OS X 10.6.8. I can't run OO.o 4.1.x on OS X
10.6.8, so I haven't tried it on OO.o 4.1.
Thus I think that this is an interaction between the array formula context, and
the array parameter for "row" where a scalar is expected, and the 0 value for
the parameter "column" asking for an array rather than a scalar result.
One possible response is, this computation model for INDEX() in an array
context calls for this. Explain the computation model, and I'll be happy to
write it up for the documentation at
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_INDEX_function .
Or, this might be a bug. In which case, that is also good to know.
--
You are receiving this mail because:
You are the assignee for the issue.
You are watching all issue changes.