Google Sheets SWITCH Function: Syntax, Examples & Tips

The SWITCH function evaluates an expression against a list of values and returns the corresponding result for the first match found.
Google Sheets
SWITCH(expression, case1, value1, [default or case2, value2], …)

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

On this page
  1. Parameters
  2. What is a SWITCH Function?
  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 cases.

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

value1:
The value that will be returned if the expression matches case1.

default or case2:
An optional additional case to compare against the expression. If the expression matches this case, the corresponding value2 will be returned. You can include multiple cases and values in this format.

value2:
The value that will be returned if the expression matches case2. This can be repeated for additional cases and values.

What is a SWITCH Function?

The SWITCH function in Google Sheets is a useful tool that allows you to evaluate a single expression against a list of values and return a corresponding result. It simplifies the process of handling multiple conditions by eliminating the need for nested IF statements. This function is particularly handy when you have a fixed set of possible outcomes.

In simpler terms, SWITCH lets you check a value against several cases and return a specific result based on which case matches.

A Practical Example

Imagine you are managing a grading system for students based on their scores:

Scores Table:

StudentIDScore
185
272
390
460

You want to assign a letter grade based on the score, where:

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

SWITCH Formula

To achieve this, you would use the SWITCH function as follows:

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

In this formula:

  • TRUE is the expression being evaluated.
  • Each condition checks the score in cell B2 against the specified thresholds.
  • The corresponding letter grade is returned based on the first condition that evaluates to TRUE.
  • If none of the conditions are met, it defaults to "F".

Result of the Formula

When you apply the SWITCH formula to the Scores Table, the output would look like this:

StudentIDScoreGrade
185B
272C
390A
460D

Why Use SWITCH?

SWITCH is beneficial because it streamlines the process of evaluating multiple conditions in your spreadsheet. It makes your formulas easier to read and maintain compared to using nested IF statements. Additionally, it reduces the likelihood of errors in complex logical evaluations.

Key Takeaways:

  • SWITCH: A Google Sheets function that evaluates an expression against a list of values and returns a corresponding result.
  • Simplifies Logic: Eliminates the need for nested IF statements, making formulas cleaner and easier to understand.
  • Flexible: Can handle multiple conditions efficiently, making it suitable for various scenarios.
  • Common Use Cases: Ideal for grading systems, categorizing data, and any situation where multiple outcomes are based on a single input.

SWITCH is an essential function for anyone working with data in Google Sheets, providing a powerful way to simplify logical evaluations and enhance data organization.

Happy spreadsheeting!

Example use case

You have a table where Column A lists product codes and Column B contains their categories. You can use the SWITCH formula to categorize a specific product code, allowing for quick identification of its category without nested IF statements.

Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

Explore all Google Sheets formulas

Browse our complete library of Google Sheets 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.