0
0
Excelspreadsheet~10 mins

SWITCH function in Excel - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

This table lists fruits in column A and their basic colors in column B. Column C will use the SWITCH function to describe the color.

CellValue
A1Fruit
A2Apple
A3Banana
A4Cherry
B1Color
B2Red
B3Yellow
B4Red
C1Color Description
C2
C3
C4
Formula Trace
=SWITCH(B2, "Red", "Color is Red", "Yellow", "Color is Yellow", "Unknown Color")
Step 1: SWITCH("Red", "Red", "Color is Red", "Yellow", "Color is Yellow", "Unknown Color")
Cell Reference Map
    A       B           C
1 | Fruit | Color    | Color Description
2 | Apple | Red      | --> Formula uses B2
3 | Banana| Yellow   | 
4 | Cherry| Red      | 
The formula in C2 references cell B2 to check the fruit color and returns a description based on that.
Result
    A       B           C
1 | Fruit | Color    | Color Description
2 | Apple | Red      | Color is Red
3 | Banana| Yellow   | 
4 | Cherry| Red      | 
The formula in C2 returns "Color is Red" because B2 contains "Red" which matches the first case in SWITCH.
Sheet Trace Quiz - 3 Questions
Test your understanding
What will the formula return if B2 contains "Yellow"?
AColor is Red
BColor is Yellow
CUnknown Color
DError
Key Result
SWITCH(expression, value1, result1, value2, result2, ..., default_result) returns the result matching expression or default if no match.