Description of the SWITCH function in Calc is confusing, and also omits any mention of the optional default ("else") value, cf. https://support.office.com/en-us/article/SWITCH-function-47ab33c0-28ce-4530-8a45-d532ec4aa25e I just tested that specifying a default value actually works as expected, it is just not documented/mentioned in the function description as it should be. Current wording: "Checks 1 or more values and returns a result corresponding to the first value equal to the given expression." Better wording: "Tests an expression against a list of values and returns the result corresponding to the first value equal to the expression. Optionally, a default value may be set, to be returned if none of the values match the expression." A new field should be added for the default value in the Functions wizard. Description for "expression" field should be slightly changed as well. Currently: "Value that will be compared against value1-valueN." Better: "Value that will be compared against value1...value30." (to remove possible ambiguity of the dash/minus sign)De
The SWITCH function was added in bug #97831 - added as "see also".
Help page request for SWITCH, among others, at bug #99517.
Seems like a perfectly valid suggestion.
@Mikhel -- Just to be sure -- you are referring to the "Function Wizard" (Ctrl-F2) in Calc and the "explanation" provided if the SWITCH function is selected. Is that correctly understood? Also please see: https://help.libreoffice.org/7.1/en-US/text/scalc/01/func_switch.html (produced in 2019/20). Maybe some of that text can be used in a revised explanation. (The problem that you have reported is still present in 7.1.0.0.alpha.) > A new field should be added for the default value in the Functions wizard. > > Description for "expression" field should be slightly changed as well. > Currently: "Value that will be compared against value1-valueN." > Better: "Value that will be compared against value1...value30." (to remove > possible ambiguity of the dash/minus sign)De I could not find this in Functions Wizard. Does this point still apply? (This is not exactly a "documentation" problem -- because it is in UI, but in this case I should be able to help, once we have located what should be changed and to what.)
(In reply to sdc.blanco from comment #4) > @Mikhel -- Just to be sure -- you are referring to the "Function Wizard" > (Ctrl-F2) in Calc and the "explanation" provided if the SWITCH function is > selected. Is that correctly understood? Both the Function Wizard and the tooltip that's shown when one starts typing =Switch in a cell. > Also please see: > https://help.libreoffice.org/7.1/en-US/text/scalc/01/func_switch.html > (produced in 2019/20). > > Maybe some of that text can be used in a revised explanation. (The problem > that you have reported is still present in 7.1.0.0.alpha.) Very good that at least the Help now documents this. > > A new field should be added for the default value in the Functions wizard. > > > > Description for "expression" field should be slightly changed as well. > > Currently: "Value that will be compared against value1-valueN." > > Better: "Value that will be compared against value1...value30." (to remove > > possible ambiguity of the dash/minus sign)De > > I could not find this in Functions Wizard. That's exactly the point ;) > (This is not exactly a "documentation" problem -- because it is in UI, but > in this case I should be able to help, once we have located what should be > changed and to what.) Indeed, bug 80430 is about gaps in Help - but this bug is about a "gap" in UI. Removed reference to 80430. Simplest way to solve this here bug would be to change/amend a few text strings in the UI, most importantly the description of the function: - "Checks 1 or more values and returns a result corresponding to the first value equal to the given expression." + "Tests an expression against a list of values and returns the result corresponding to the first value that matches the expression. Optionally, a default result may be given instead of the final value-result pair, to be returned if none of the values match the expression." For added clarity, the following two could be changed as well: 1) The description of Result2...Result127 (NB: only starting from 2nd - not sure how easily this can be done): - "Value to return when corresponding value argument matches expression." + "Value to return when corresponding value argument matches expression, or alternatively a default value to return." 2) The description of Expression: - "Value that will be compared against value1-valueN." + "Value that will be compared against value1...value127."
(In reply to Mihkel Tõnnov from comment #5) > Very good that at least the Help now documents this. To be sure: No additional changes are needed in the online Help page for Switch? Thanks for response. I think we can find some good solutions. As a translator, you know that we have to get it right the first time. (-: So I will make some proposals, based on yours, and let's see if we can find some good formulations. > - "Checks 1 or more values and returns a result corresponding to the first > value equal to the given expression." > + "Tests an expression against a list of values and returns the result > corresponding to the first value that matches the expression. Optionally, a > default result may be given instead of the final value-result pair, to be > returned if none of the values match the expression." NB. This should look all right in Function Wizard, it will make a LONG tooltip for =SWITCH. But we can try. I tried to imagine how it would appear as tooltip. (as you know, in Function Wizard, the syntax is also present, which makes the text easier to interpret.) Compares expression against list of value/result pairs, and returns result for first value that equals the expression. If expression does not equal any value, a default result is returned, if it placed as final item in parameter list without a value. > 1) The description of Result2...Result127 (NB: only starting from 2nd - not > sure how easily this can be done): > - "Value to return when corresponding value argument matches expression." > + "Value to return when corresponding value argument matches expression, or > alternatively a default value to return." -Not so easy to do, but also maybe not necessary. -The new "SWITCH" tip introduces the idea of "default", and my proposal explains how to do it. -"default" is always (implicitly) a "Value to return" as it currently says. -would make another long tooltip > 2) The description of Expression: > - "Value that will be compared against value1-valueN." > + "Value that will be compared against value1...value127." My proposal: "Value to be compared against value1…valueN (N ≤ 127)." Should be able to make the patch right away, once we decide on the texts. Thanks.
Seth Chaiklin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b8480abd38016378e92e2e3f6690f1c219dbadd2 Resolves: tdf#103419 - update tooltip for SWITCH in Calc It will be available in 7.1.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Seth Chaiklin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/b63c7644809e62a5f179ccd62b9975695e8f1d2b tdf#103419 add missing functions to "Logical" category help page in Calc
@Mikhel -- I will close this as FIXED, but you are welcome to follow up here. I think you will be pleased when you see the further developments in the tooltips, even if not yet perfect. In the help pages, SWITCH (and a few others) were missing from the help on the Logical category of functions, so that was added too.