Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • How to get relative row numbers in a range in Excel
  • How to use Excel ROWS Function
  • Two-way lookup with VLOOKUP in Excel
  • How to reference named range different sheet in Excel
  • How to get last row in numeric data in Excel

Data Analysis Examples

  • Use Data Form to input, edit and delete records in Excel
  • Excel Pie Chart
  • Excel Bar Chart
  • Error Bars in Excel
  • Data Series in Excel

Data Validation Examples

  • Excel Data validation must begin with
  • Excel Data validation must not contain
  • Excel Data validation no punctuation
  • Excel Data validation only dates between
  • Excel Data validation number multiple 100

SWITCH function: Description, Usage, Syntax, Examples and Explanation

by

What is SWITCH function in Excel?

SWITCH function is one of the Logical functions in Microsoft Excel that evaluates 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.

Syntax of SWITCH function

In its simplest form, the SWITCH function says:

  • =SWITCH(Value to switch, Value to match1…[2-126], Value to return if there’s a match1…[2-126], Value to return if there’s no match)
Worked Example:   SWITCH function example in Excel

Where you can evaluate up to 126 matching values and results.

See the following formula:

  1. Value to switch? In this case, WEEKDAY(A2) equals 2.
  2. What value do you want to match? In this case, it’s 1, 2 and 3.
  3. If there’s a match, what do you want to return as a result? In this case, it would be Sunday for 1, Monday for 2 and Tuesday for 3.
  4. Default value to return if there’s no match found. In this case, it’s the text “No match”.

    Note: If there are no matching values, and no default argument is supplied, the SWITCH function returns the #N/A! error.

Examples of SWITCH function

Steps to follow:

Worked Example:   SWITCH function example in Excel

1. Open a new Excel worksheet.

2. Copy data in the following table below and paste it in cell A1

Note: For formulas to show results, select them, press F2 key on your keyboard and then press Enter.

Worked Example:   SWITCH function example in Excel

You can adjust the column widths to see all the data, if need be.

Example

Value Formula Result
2 =SWITCH(WEEKDAY(A2),1,”Sunday”,2,”Monday”,3,”Tuesday”,”No match”) Because A2=2, and Monday is the result argument corresponding to the value 2, SWITCH returns Monday
99 =SWITCH(A3,1,”Sunday”,2,”Monday”,3,”Tuesday”) Because there’s no match and no else argument, SWITCH returns #N/A!
99 =SWITCH(A4,1,”Sunday”,2,”Monday”,3,”Tuesday”,”No match”) No match
2 =SWITCH(A5,1,”Sunday”,7,”Saturday”,”weekday”) weekday
3 =SWITCH(A6,1,”Sunday”,2,”Monday”,3,”Tuesday”,”No match”) Tuesday

For more SWITCH function example visit:

  • SWITCH function example in Excel

Post navigation

Previous Post:

OR function: Description, Usage, Syntax, Examples and Explanation

Next Post:

NOT function: Description, Usage, Syntax, Examples and Explanation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • How to use double quotes inside a formula in Excel
  • EXACT function: Description, Usage, Syntax, Examples and Explanation
  • FIXED function: Description, Usage, Syntax, Examples and Explanation
  • REPLACE, REPLACEB functions: Description, Usage, Syntax, Examples and Explanation
  • How to count number of characters of text in a cell in Excel
  • Display Days in month in Excel
  • Get work hours between dates and times in Excel
  • Get date from day number in Excel
  • DAYS function: Description, Usage, Syntax, Examples and Explanation
  • Convert decimal seconds to Excel time
  • Example of payment for annuity in Excel
  • AMORLINC function: Description, Usage, Syntax, Examples and Explanation
  • PV function: Description, Usage, Syntax, Examples and Explanation
  • NPV function: Description, Usage, Syntax, Examples and Explanation
  • CUMIPMT function: Description, Usage, Syntax, Examples and Explanation
Acronyms, Abbreviations, Initialism & What They Stand For
© 2022 xlsoffice . All Right Reserved. | Teal Smiles