Skip to main content
Back to Blog
Excel TipsFormulas

How to Use IFS and SWITCH in Excel

Desk Dojo··5 min read

Introduction

Nested IF formulas get ugly fast. Three or four levels deep and you're counting parentheses instead of thinking about your data. Excel offers two alternatives, IFS and SWITCH, that flatten those nested stacks into a single readable formula.

The Dataset

Here's a class roster with exam scores:

A B
3 Student Score
4 Emma 92
5 Liam 74
6 Sofia 85
7 Noah 61
8 Ava 48

The goal is to assign letter grades based on each score: A for 90+, B for 80-89, C for 70-79, D for 60-69, and F for anything below 60.

The Nested IF Problem

Before looking at the alternatives, here's what the grading formula looks like with a standard nested IF:

=IF(B4>=90,"A",IF(B4>=80,"B",IF(B4>=70,"C",IF(B4>=60,"D","F"))))

It works, but it's hard to read and easy to break. Each condition nests inside the previous one's FALSE argument, creating a stack of closing parentheses at the end. If you need to add a new grade tier later, you have to restructure the whole formula.

IFS

IFS solves the nesting problem by letting you list all your conditions and results in a flat sequence. It evaluates each condition in order and returns the result for the first one that's TRUE. The syntax is:

=IFS(condition1, value1, condition2, value2, ...)
  • condition1: The first logical test.
  • value1: The result if condition1 is TRUE.
  • condition2, value2: Additional test-result pairs.

Here's the same grading formula rewritten with IFS:

=IFS(B4>=90,"A",B4>=80,"B",B4>=70,"C",B4>=60,"D",TRUE,"F")
Student Score Grade
Emma 92 A
Liam 74 C
Sofia 85 B
Noah 61 D
Ava 48 F

IFS checks each condition from left to right and stops at the first match. Emma's 92 hits B4>=90 first, so it returns "A" without checking the rest. Ava's 48 fails every condition until it reaches TRUE, the catch-all at the end. Think of TRUE as the equivalent of a final ELSE in a nested IF chain.

Order matters. If you put B4>=60 before B4>=90, a score of 95 would match B4>=60 first and incorrectly return "D". Always list your conditions from the most restrictive to the least restrictive.

Key takeaway: Use TRUE as the last condition in IFS to handle anything that doesn't match the earlier tests. Without it, IFS returns a #N/A error when no condition is met.

SWITCH

While IFS handles ranges and conditions, SWITCH is designed for a different scenario: matching a single value against a list of exact options. The syntax is:

=SWITCH(expression, value1, result1, value2, result2, ..., [default])
  • expression: The value to match against.
  • value1, result1: If expression equals value1, return result1.
  • default: The result if no values match (optional but recommended).

Since SWITCH works with exact matches rather than ranges, here's a different dataset with department codes:

A B
3 Employee Dept Code
4 Sarah MKT
5 James ENG
6 Marcus FIN
7 Rachel ENG
8 David OPS

To convert each code into its full department name:

=SWITCH(B4,"MKT","Marketing","ENG","Engineering","FIN","Finance","OPS","Operations","Unknown")
Employee Dept Code Department
Sarah MKT Marketing
James ENG Engineering
Marcus FIN Finance
Rachel ENG Engineering
David OPS Operations

For comparison, here's the equivalent nested IF:

=IF(B4="MKT","Marketing",IF(B4="ENG","Engineering",IF(B4="FIN","Finance",IF(B4="OPS","Operations","Unknown"))))

SWITCH is shorter and easier to scan because each value-result pair sits side by side. The last argument ("Unknown") is the default, returned when none of the values match.

IFS vs SWITCH

Both replace nested IFs, but they solve different problems:

IFS SWITCH
Best for Ranges and conditions (>=, <, <>) Exact matches
How it works Tests conditions in order Matches a value against a list
Catch-all TRUE as the last condition Default as the last argument
Example use Score ranges to grades Department codes to names

Use IFS when your logic involves comparisons like "greater than 90" or "between 80 and 89," and use SWITCH when you're matching exact values like "MKT" or "ENG."

Conclusion

IFS handles ranges and conditions, while SWITCH handles exact matches. Both give you the same results as nested IFs, but with fewer parentheses and formulas that are much easier to read and maintain.

For the basics of IF logic, see our guide on IF, AND, and OR. For handling errors that these formulas might produce, check out our guide on IFERROR.

Level up your Excel skills

Bite-sized lessons, drills, and daily challenges to build real spreadsheet skills.