Talk:Documentation/Calc Functions/CHOOSE
SF Comments
- (1) Summary. Suggest inserting “supplied” before “list”.
- (2) Returns. Suggest simplifying with the following replacement text – “Returns one of the values supplied as arguments, selected using the supplied index.”.
- (3) Arguments, Index. Suggest the following replacement text – “Index is a positive integer or a reference to the cell containing that number, which determines the value that is to be selected from the list and returned. If Index is 1, the function returns the first value in the list; if Index is 2, it returns the second value in the list; and so on.”.
- (4) Arguments, Values. Suggest the following replacement text – “Value1, Value2, ..., Value30 are values from which one is to be selected and returned. Each may be text, a number (real or integer), a logical value, a reference, or a formula.”.
- (5) Arguments, 1st bullet. Replace “not an integer” with “a real”. Maybe also point out that if it is not a number, then an error will occur.
- (6) Arguments, 2nd bullet. Suggest replacing with the following simplification – “If after truncation, Index is not in the range from 1 to the number of values in the supplied list (inclusive), then the function returns an error value.”.
- (7) Arguments, general. I have noticed that providing separators are present, values can be omitted (in which case Calc returns 0 if that missing value is indexed). For example, =CHOOSE(2,"str1",,"str3") returns 0. This is worth mentioning.
: (8) Arguments, general. As stated on the relevant OpenOffice page, the formula =SUM(CHOOSE(1; A7:A9; B12)) returns the sum of the numbers in the range A7:A9. Hence it is possible to include a cell range as one of the values. Note however that this needs to be in context for =CHOOSE(1; A7:A9; B12) gives a #VALUE! error. This aspect should be covered somewhere on the wiki page.
- (9) Additional detail. The ODF contains the text “Expression paths of parameters other than the one chosen are not calculated or evaluated for side effects.”. I think you can demonstrate this with Calc using a simple formula like =CHOOSE(1,A1,SQRT(-1)) which happily returns the value in cell A1. But, the formula =CHOOSE(2,A1,SQRT(-1)) gives an Error 502 (i.e. the SQRT is only executed when that formula is indexed). Please cover this aspect of the function’s behaviour.
- (10) Examples, 1st example. Insert “the” before “4th”.
- (11) Examples, 2nd example. Insert “the” before “2nd”.
- (12) Examples, 3rd example. Insert “a” before “10th” and delete “indexed”.
--Stevefanning (talk) 2020-12-06T17:22:47 (UTC)