From 9db68c8ce0b3f2ed588345a5d3fb33c4af545bb7 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 27 Dec 2022 23:24:44 +0100 Subject: [PATCH] Correct INDEX() syntax and adapt to reality, clarify semantics Row and Column arguments are not only optional but can also be omitted / given as empty argument. Reword the multiple ranges explanation. Remove a decade old source comment. Change-Id: Ie34e4731b88d4b3adc4a6d0cc98c9e4a02b3c669 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/144846 Reviewed-by: Eike Rathke Tested-by: Jenkins --- source/text/scalc/01/04060109.xhp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/text/scalc/01/04060109.xhp b/source/text/scalc/01/04060109.xhp index 1ae6e7198e..9ef9c0982b 100644 --- a/source/text/scalc/01/04060109.xhp +++ b/source/text/scalc/01/04060109.xhp @@ -179,17 +179,17 @@

INDEX

- INDEX returns a sub range, specified by row and column number, or an optional range index. Depending on context, INDEX returns a reference or content.UFI: will change with i4904; see http://so-web.germany.sun.com/iBIS/servlet/edit.ControlPanel?tid=i57108changed by i83070 +INDEX returns a sub range, specified by row and column number, and/or an optional range index. - INDEX(Reference [; Row [; Column [; Range]]]) + INDEX(Reference [; [Row] [; [Column] [; Range]]]) - Reference is a reference, entered either directly or by specifying a range name. If the reference consists of multiple ranges, you must enclose the reference or range name in parentheses. + Reference is a reference, entered either directly or by specifying a range name. If the reference consists of multiple ranges, you must enclose the list of references or range names in parentheses, or use the tilde (~) concatenation/union operator. - Row (optional) represents the row index of the reference range, for which to return a value. In case of zero (no specific row) all referenced rows are returned. + Row (optional) represents the row index of the reference range, for which to return a value. In case of zero or omitted (no specific row) all referenced rows are returned. - Column (optional) represents the column index of the reference range, for which to return a value. In case of zero (no specific column) all referenced columns are returned. + Column (optional) represents the column index of the reference range, for which to return a value. In case of zero or omitted (no specific column) all referenced columns are returned. - Range (optional) represents the index of the subrange if referring to a multiple range. + Range (optional) represents the index of the subrange if referring to a multiple range, default 1. =INDEX(Prices;4;1) returns the value from row 4 and column 1 of the database range defined in Data - Define as Prices. @@ -199,12 +199,12 @@ =INDEX(A1:B6;1) returns a reference to the first row of A1:B6. =INDEX(A1:B6;0;1) returns a reference to the first column of A1:B6. - - =INDEX((multi);4;1) indicates the value contained in row 4 and column 1 of the (multiple) range, which you named under Sheet - Named Ranges and Expressions - Define as multi. The multiple range may consist of several rectangular ranges, each with a row 4 and column 1. If you now want to call the second block of this multiple range enter the number 2 as the range parameter. =INDEX(A1:B6;1;1) indicates the value in the upper-left of the A1:B6 range. - =INDEX((multi);0;0;2) returns a reference to the second range of the multiple range. + =INDEX((A1:B6;C1:D6);0;0;2) returns a reference to the second range C1:D6 of the multiple range. + + =INDEX(multi;4;1) indicates the value contained in row 4 and column 1 of the (multiple) range, which you named under Sheet - Named Ranges and Expressions - Define as multi with the expression (A1:B6;C1:D6) for example. The multiple range may consist of several rectangular ranges, each with a row 4 and column 1. If you now want to call the second block of this multiple range enter the number 2 as the Range parameter.
INDIRECT function