How do I Write a Case Statement in Excel?

Writing a case statement in Excel is a way of using the IF function to evaluate a condition and produce a result based on the value of the condition. To write a case statement in Excel, the syntax of the IF function must be used to evaluate the condition and then set the result based on the value of the condition. The syntax of the IF function is IF(condition, result if true, result if false). Once the IF function is correctly constructed, the result of the condition can be determined and the statement can be completed.


A case statement is a type of statement that goes through conditions and returns a value when the first condition is met.

The easiest way to implement a case statement in Excel is by using the SWITCH() function, which uses the following basic syntax:

=SWITCH(A2, "G", "Guard", "F", "Forward", "C", "Center", "None")

This particular function looks at cell A2 and returns the following value:

  • Guard” if cell A2 contains “G”
  • Forward” if cell A2 contains “F”
  • Center” if cell A2 contains “C”
  • None” if cell A2 does not contain any of the previous values

The following example shows how to use this function in practice.

Example: Case Statement in Excel

Suppose we have the following list of basketball positions:

We’ll use the following SWITCH() function to return a specific position name in column B based on the value in column A:

=SWITCH(A2, "G", "Guard", "F", "Forward", "C", "Center", "None")

We’ll type this formula into cell B2 and then copy and paste it down to every remaining cell in column B:

case statement in Excel

Notice that this formula returns the following values in column B:

  • Guard” if column A contains “G”
  • Forward” if column A contains “F”
  • Center” if column A contains “C”
  • None” if column A does not contain any of the previous values

Notice that the last value in column B returns a value of “None” since we didn’t specify a specific value to return for “Z” in the formula.

x