Excel SWITCH Function: Syntax, Examples & Tips

The SWITCH function evaluates multiple conditions and returns a corresponding result, streamlining complex nested IF statements in Excel.
Excel
=SWITCH(expression, value1, result1, [value2, result2], ..., [default])

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

Need more than a single SWITCH formula? Try our free AI for Excel — it reads your entire spreadsheet, answers questions in plain English, and builds charts and analysis in the same chat.

On this page
  1. Parameters
  2. What is a SWITCH Formula in Excel?
  3. A Practical Example
  4. SWITCH Formula
  5. Result of the Formula
  6. Why Use SWITCH?
  7. Key Takeaways:
  8. Example use case

Parameters

expression:
The value or expression that you want to evaluate against the specified values.

value1:
The first value to compare against the expression. If the expression matches this value, the corresponding result1 will be returned.

result1:
The result that will be returned if the expression matches value1.

value2:
The second value to compare against the expression. This is optional and can be repeated for additional values.

result2:
The result that will be returned if the expression matches value2. This is optional and can be repeated for additional results.

default:
The result that will be returned if none of the specified values match the expression. This is optional.

What is a SWITCH Formula in Excel?

The SWITCH function in Excel is a versatile tool that allows you to evaluate an expression against a list of values and return a corresponding result for the first match found. It simplifies the process of handling multiple conditions by eliminating the need for nested IF statements.

In simpler terms, the SWITCH function helps you choose from multiple options based on a specific value, making it easier to manage complex decision-making scenarios in your data.

A Practical Example

Imagine you are managing a grading system for students, and you have the following data in an Excel spreadsheet:

Student Grades Table:

StudentScore
Alice85
Bob72
Charlie90
David65
Eve78

You want to assign letter grades based on the scores using the following criteria:

  • 90 and above: A
  • 80 to 89: B
  • 70 to 79: C
  • 60 to 69: D
  • Below 60: F

SWITCH Formula

To assign letter grades based on the scores, you would use the SWITCH formula as follows:

Excel
=SWITCH(TRUE, B2>=90, "A", B2>=80, "B", B2>=70, "C", B2>=60, "D", "F")

Breakdown of the Formula:

  • TRUE: This is the expression being evaluated. It allows for multiple conditions to be checked.
  • B2>=90, "A": If the score in cell B2 is 90 or above, return "A".
  • B2>=80, "B": If the score in cell B2 is between 80 and 89, return "B".
  • B2>=70, "C": If the score in cell B2 is between 70 and 79, return "C".
  • B2>=60, "D": If the score in cell B2 is between 60 and 69, return "D".
  • "F": If none of the above conditions are met, return "F".

Result of the Formula

When you apply the formula to each student's score, you will get the following letter grades:

StudentScoreGrade
Alice85B
Bob72C
Charlie90A
David65D
Eve78C

Here, the grades are assigned based on the defined criteria.

Why Use SWITCH?

The SWITCH function is particularly useful when you need to evaluate multiple conditions without the complexity of nested IF statements. It allows for clearer and more readable formulas, making it easier to manage and update your data analysis.

Key Takeaways:

  • SWITCH: Evaluates an expression against a list of values and returns the first matching result.
  • Simplified Decision Making: Reduces the complexity of nested IF statements for multiple conditions.
  • Common Use Cases: Ideal for categorizing data, assigning labels, and any scenario where multiple outcomes are possible based on a single value.

Understanding how to use the SWITCH function can significantly enhance your data analysis capabilities in Excel, enabling you to create more efficient and readable formulas.

Happy switching!

Example use case

You have a table where Column A contains product categories (e.g., "Electronics," "Clothing," "Groceries") and Column B contains the corresponding discount rates for each category. You can use the SWITCH function to determine the discount percentage based on the product category selected in a separate cell. This allows for quick and easy application of the correct discount rate to sales calculations, streamlining the pricing process and enhancing customer satisfaction without the need for nested IF statements.

Beyond the SWITCH function: Better Analyst is a full Excel AI that goes well past individual formulas. Upload any spreadsheet and ask questions in plain English — you'll get formulas, data analysis, and charts back in seconds. It's a free AI Excel assistant that works with any .xlsx, .xls, or .csv file — no plugins, no Microsoft 365 required.

Don't have a spreadsheet yet? Use our free AI spreadsheet generator to turn a text prompt into a downloadable Excel file — a full AI Excel sheet maker that builds headers, columns, and formulas from your description.

Need more help with Excel formulas?

Create a free account for formula help, explanations, and spreadsheet analysis. Usage limits depend on your plan.

Explore all Excel formulas

Browse our complete library of Excel formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.