0
0
Google Sheetsspreadsheet~10 mins

SWITCH function in Google Sheets - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to return "Apple" when the value is 1.

Google Sheets
=SWITCH(A1, [1], "Apple", "Unknown")
Drag options to blanks, or click blank then click option'
AA1
B1
C"1"
DTRUE
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around 1 makes it a text, which won't match the number 1.
Using A1 as a case instead of a value causes an error.
2fill in blank
medium

Complete the code to return "Banana" when the value is 2.

Google Sheets
=SWITCH(A2, 1, "Apple", [1], "Banana", "Unknown")
Drag options to blanks, or click blank then click option'
AA2
B"2"
C2
DFALSE
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around 2 makes it text and won't match number 2.
Using cell references as case values causes errors.
3fill in blank
hard

Fix the error in the SWITCH formula to return "Orange" when the value is 3.

Google Sheets
=SWITCH(A3, 1, "Apple", 2, "Banana", [1], "Orange", "Unknown")
Drag options to blanks, or click blank then click option'
A"3"
BA3
CTRUE
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using "3" (text) instead of 3 (number) causes no match.
Using cell references or TRUE as case values causes errors.
4fill in blank
hard

Fill both blanks to return "Red" for 1 and "Green" for 2.

Google Sheets
=SWITCH(A4, [1], "Red", [2], "Green", "Unknown")
Drag options to blanks, or click blank then click option'
A1
B2
C"1"
D"2"
Attempts:
3 left
💡 Hint
Common Mistakes
Using quoted numbers causes no match.
Swapping the cases changes the output.
5fill in blank
hard

Fill all three blanks to return uppercase fruit names for 1, 2, and 3.

Google Sheets
=SWITCH(A5, [1], "APPLE", [2], "BANANA", [3], "CHERRY", "UNKNOWN")
Drag options to blanks, or click blank then click option'
A1
B2
C3
D"3"
Attempts:
3 left
💡 Hint
Common Mistakes
Using "3" (text) instead of 3 (number) causes mismatch.
Mixing text and numbers in cases causes errors.