How to reproduce:
- Open a blank spreadsheet
- In an arbitrary cell, enter this formula:
Code: Select all
=INDEX({1;3;5|7;9;10};{2|1};0;1) - Press Command-Shift-Enter to make this formula an array formula.
- The array formula fills three columns by two rows of cells.
Cell contents are
Code: Select all
{7; #VALUE!; #VALUE! | 1; #VALUE!; #VALUE}Expected behaviour:
Cell contents are
Code: Select all
{7; 9; 10 | 1; 3; 5}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
Code: Select all
{2|1}If the formula is modified to have only a scalar value for the "row" parameter, as in
Code: Select all
=INDEX({1;3;5|7;9;10};2;0;1)Code: Select all
{7; 9; 10}If the formula is modified to have a nonzero value for the "column" parameter, as in
Code: Select all
=INDEX({1;3;5|7;9;10};{2|1};1;1)Code: Select all
{7|1}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/Docume ... X_function .
This behaviour is described in Issue 125743. (The bug report was closed without considering its merits, which seems like a surprising way to handle a bug report, but that's a separate matter.)
So, what is the correct behaviour when INDEX() is asked to return a full row in an array formula context? Where is this specified?
Thanks in advance for any clarifications you can give.