1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
-->
<meta>
<topic id="switchfunction" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">SWITCH function</title>
<filename>/text/scalc/01/func_switch.xhp</filename>
</topic>
</meta>
<body>
<section id="switch01">
<bookmark id="bm_id111556242313790" xml-lang="en-US" branch="hid/SC_HID_FUNC_SWITCH_MS" localize="false"/>
<bookmark xml-lang="en-US" branch="index" id="bm_id571556244875552">
<bookmark_value>SWITCH function</bookmark_value>
</bookmark>
<h2 id="hd_id21556242313791"><variable id="switchfunct"><link href="text/scalc/01/func_switch.xhp" name="switch">SWITCH</link></variable></h2>
<paragraph id="par_id361556242313793" role="paragraph" xml-lang="en-US"><variable id="functionswitch"><ahelp hid=".">SWITCH compares <emph>expression</emph> with <emph>value1</emph> to <emph>valuen</emph> and returns the result belonging to the first value that equals expression. If there is no match and default_result is given, that will be returned.</ahelp></variable></paragraph>
</section>
<embed href="text/scalc/01/ful_func.xhp#func_head_syntax"/>
<paragraph role="code" id="par_id521556242803283">SWITCH(expression; value1; result1[; value2; result2][; ... ; [value127; result127][; default_result]])</paragraph>
<tip id="par_id111585520651521">If you choose not to specify a default result, 127 value / result pairs may be entered as parameters. If you choose to include a default result at the end of the list of parameters, then only 126 value / result pairs may be entered.</tip>
<paragraph role="paragraph" id="par_id341556242996378"><emph>expression</emph> is a text, numeric, logical or date input or reference to a cell.</paragraph>
<paragraph role="paragraph" id="par_id321556243790332"><emph>value1, value2, ...</emph> is any value or reference to a cell. Each value must have a result given.</paragraph>
<paragraph role="paragraph" id="par_id171556243796068"><emph>result1, result2, ...</emph> is any value or reference to a cell.</paragraph>
<paragraph role="paragraph" id="par_id331556245422283"><emph>default_result</emph>: any value or reference to a cell that is returned when there is no match.</paragraph>
<paragraph role="paragraph" id="par_id871556243022881">If no <emph>value</emph> equals <emph>expression</emph> and no default result is given, a #N/A error is returned.</paragraph>
<embed href="text/scalc/01/ful_func.xhp#func_head_example"/>
<paragraph role="paragraph" id="par_id851556243961783"><input>=SWITCH(MONTH(A3),1,"January",2,"February",3,"March","No match")</input> returns "January" when A3 contains a date in January, "February" when A3 contains a date in February , etc...</paragraph>
<embed href="text/scalc/01/common_func.xhp#sectiontechinfo"/>
<embed href="text/scalc/00/avail_release.xhp#5.2"/>
<embed href="text/scalc/01/common_func.xhp#notODFF"/>
<paragraph role="paragraph" id="par_id341640873986703" localize="false"><literal>COM.MICROSOFT.SWITCH</literal></paragraph>
<section id="relatedtopics">
<embed href="text/scalc/01/func_ifs.xhp#ifsfunct"/>
<paragraph role="paragraph" id="par_id781556244709752"><link href="text/scalc/01/04060105.xhp#Section4" name="if">IF</link></paragraph>
</section>
</body>
</helpdocument>
|