0
0
Google Sheetsspreadsheet~20 mins

Find and replace in Google Sheets - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Find and Replace Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate
2:00remaining
Find and replace text in a cell
You have a cell A1 with the text "I love apples and apples are tasty". Which formula replaces all occurrences of "apples" with "oranges"?
A=REPLACE(A1, 1, 6, "oranges")
B=REPLACE(A1, FIND("apples", A1), 6, "oranges")
C=REGEXREPLACE(A1, "apples", "oranges")
D=SUBSTITUTE(A1, "apples", "oranges")
Attempts:
2 left
💡 Hint
Use a function that replaces all occurrences of a substring.
📊 Formula Result
intermediate
2:00remaining
Replace only the second occurrence of a word
Cell A1 contains "red blue red blue red". Which formula replaces only the second "red" with "green"?
A=REGEXREPLACE(A1, "red", "green", 2)
B=SUBSTITUTE(A1, "red", "green")
C=SUBSTITUTE(A1, "red", "green", 2)
D=REPLACE(A1, FIND("red", A1, FIND("red", A1)+1), 3, "green")
Attempts:
2 left
💡 Hint
SUBSTITUTE has an optional fourth argument to specify which occurrence to replace.
Function Choice
advanced
2:00remaining
Choose the best function to replace text ignoring case
You want to replace all occurrences of "cat" with "dog" in cell A1, ignoring case (so "Cat", "CAT", "cat" all replaced). Which function should you use?
A=REGEXREPLACE(A1, "(?i)cat", "dog")
B=SUBSTITUTE(A1, "cat", "dog")
C=REPLACE(A1, FIND("cat", A1), 3, "dog")
D=LOWER(SUBSTITUTE(LOWER(A1), "cat", "dog"))
Attempts:
2 left
💡 Hint
Use a function that supports case-insensitive matching.
data_analysis
advanced
2:00remaining
Count how many times a word appears before replacing
Cell A1 contains "apple banana apple orange apple banana". Which formula counts how many times "apple" appears?
A=(LEN(A1) - LEN(SUBSTITUTE(A1, "apple", ""))) / LEN("apple")
B=COUNTIF(A1, "apple")
C=ARRAYFORMULA(SUM(LEN(A1) - LEN(SUBSTITUTE(A1, "apple", ""))))
D=LEN(SPLIT(A1, " ")) - LEN(SUBSTITUTE(A1, "apple", ""))
Attempts:
2 left
💡 Hint
Count by comparing length before and after removing the word.
🎯 Scenario
expert
3:00remaining
Replace multiple different words in one formula
You want to replace "cat" with "dog" and "mouse" with "rat" in cell A1 in one formula. Which formula does this correctly?
A=REGEXREPLACE(A1, "cat|mouse", {"dog", "rat"})
B=SUBSTITUTE(SUBSTITUTE(A1, "cat", "dog"), "mouse", "rat")
C=ARRAYFORMULA(SUBSTITUTE(A1, {"cat", "mouse"}, {"dog", "rat"}))
D=REPLACE(REPLACE(A1, FIND("cat", A1), 3, "dog"), FIND("mouse", A1), 5, "rat")
Attempts:
2 left
💡 Hint
Try nesting SUBSTITUTE functions for multiple replacements.