<!DOCTYPE html> <html> <head> <title>SWITCH Function</title> <meta charset="utf-8" /> <meta name="description" content="" /> <link type="text/css" rel="stylesheet" href="../editor.css" /> <script type="text/javascript" src="../callback.js"></script> <script type="text/javascript" src="../search/js/page-search.js"></script> </head> <body> <div class="mainpart"> <div class="search-field"> <input id="search" class="searchBar" placeholder="Search" type="text" onkeypress="doSearch(event)"> </div> <h1>SWITCH Function</h1> <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> <p style="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> <p style="text-indent: 50px;"><b><em>expression</em></b> is the value that will be compared against <b><em>value1 ...value126</em></b>.</p> <p style="text-indent: 50px;"><b><em>value1 ...value126</em></b> is the value that will be compared against <b><em>expression</em></b>.</p> <p style="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> <p style="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> <p class="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> <img alt="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 <img alt="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> <p style="text-indent: 150px;"><img alt="SWITCH Function" src="../images/switch.png" /></p> </div> </body> </html>