<p>The <b>SWITCH</b> function is one of the logical functions. It is used to evaluate one value (called the expression) against a list of values, and returns the result corresponding to the first matching value. If there is no match, an optional default value may be returned.</p>
<p>The <b>SWITCH</b> function syntax is:</p>
<pstyle="text-indent: 150px;"><b><em>SWITCH(expression, value1, result1 [, [default or value2] [, [result2]], ...[default or value3, result3]])</em></b></p>
<p><em>where</em></p>
<pstyle="text-indent: 50px;"><b><em>expression</em></b> is the value that will be compared against <b><em>value1 ...value126</em></b>.</p>
<pstyle="text-indent: 50px;"><b><em>value1 ...value126</em></b> is the value that will be compared against <b><em>expression</em></b>.</p>
<pstyle="text-indent: 50px;"><b><em>result1 ...result126</em></b> is the result to be returned if the <b><em>value1 ...value126</em></b> matches to the <b><em>expression</em></b>.</p>
<pstyle="text-indent: 50px;"><b><em>default</em></b> is the result to be returned if there are no matches. If the <b><em>default</em></b> argument is not specified and there are no matches, the function returns the #N/A error.</p>
<pclass="note"><b>Note</b>: you can enter up to <b>254</b> arguments i.e. up to 126 pairs of values and results.</p>
<p>To apply the <b>SWITCH</b> function,</p>
<ol>
<li>select the cell where you wish to display the result,</li>
<li>click the <b>Insert function</b><imgalt="Insert function icon"src="../images/insertfunction.png"/> icon situated at the top toolbar,
<br/>or right-click within a selected cell and select the <b>Insert Function</b> option from the menu,
<br/>or click the <imgalt="Function icon"src="../images/function.png"/> icon situated at the formula bar,
</li>
<li>select the <b>Logical</b> function group from the list,</li>
<li>click the <b>SWITCH</b> function,</li>
<li>enter the required arguments separating them by commas,
</li>
<li>press the <b>Enter</b> button.</li>
</ol>
<p>The result will be displayed in the selected cell.</p>