What does the SUBSTITUTE function do in Google Sheets?
SUBSTITUTE replaces all or specific occurrences of a text string within another text string with a new text string.
Click to reveal answer
beginner
How does the REPLACE function differ from SUBSTITUTE?
REPLACE changes part of a text string based on position and length, while SUBSTITUTE replaces text based on matching content.
Click to reveal answer
beginner
Syntax of SUBSTITUTE function?
SUBSTITUTE(text, old_text, new_text, [instance_num]) - text: original text - old_text: text to replace - new_text: replacement text - instance_num (optional): which occurrence to replace
Click to reveal answer
beginner
Syntax of REPLACE function?
REPLACE(old_text, start_num, num_chars, new_text) - old_text: original text - start_num: position to start replacing - num_chars: number of characters to replace - new_text: replacement text
Click to reveal answer
intermediate
Example: How to replace the 2nd occurrence of "apple" with "orange" in "apple, apple, apple" using SUBSTITUTE?
Use =SUBSTITUTE("apple, apple, apple", "apple", "orange", 2) which results in "apple, orange, apple".
Click to reveal answer
Which function replaces text based on position and length?
ASUBSTITUTE
BREPLACE
CCONCATENATE
DLEFT
✗ Incorrect
REPLACE changes text by position and length, SUBSTITUTE replaces text by matching content.
What does the optional 4th argument in SUBSTITUTE do?
ASpecifies which occurrence of old_text to replace
BSpecifies the number of characters to replace
CSpecifies the starting position to replace
DSpecifies the new text to add
✗ Incorrect
The 4th argument tells SUBSTITUTE which occurrence of old_text to replace.
If you want to replace the first 3 characters in a text, which function and arguments would you use?
ASUBSTITUTE(text, old_text, new_text, 3)
BSUBSTITUTE(text, 1, 3, new_text)
CREPLACE(text, 3, 1, new_text)
DREPLACE(text, 1, 3, new_text)
✗ Incorrect
REPLACE with start_num=1 and num_chars=3 replaces the first 3 characters.
What will =SUBSTITUTE("banana", "a", "o") return?
Abonono
Bbanana
Cbonana
Dbanano
✗ Incorrect
SUBSTITUTE replaces all occurrences of "a" with "o", so "banana" becomes "bonono".
Which function can replace only the 3rd occurrence of a word?
AREPLACE
BRIGHT
CSUBSTITUTE with instance_num=3
DLEFT
✗ Incorrect
SUBSTITUTE with the 4th argument set to 3 replaces only the 3rd occurrence.
Explain how SUBSTITUTE and REPLACE functions differ and give an example of when to use each.
Think about whether you want to replace by matching text or by position.
You got /4 concepts.
Describe the arguments needed for SUBSTITUTE and how to replace only the second occurrence of a word.
Remember the optional 4th argument controls which occurrence to replace.
You got /3 concepts.
Practice
(1/5)
1. What does the SUBSTITUTE function do in Google Sheets?
easy
A. It formats cells with colors.
B. It changes text based on position and length.
C. It adds numbers together.
D. It replaces specific text by matching exact words or letters.
Solution
Step 1: Understand SUBSTITUTE purpose
The SUBSTITUTE function looks for specific text and replaces it exactly where it matches.
Step 2: Compare with REPLACE
Unlike REPLACE, SUBSTITUTE does not use position but matches text content.
Final Answer:
It replaces specific text by matching exact words or letters. -> Option D
Quick Check:
SUBSTITUTE = Replace by matching text [OK]
Hint: SUBSTITUTE changes text by matching words, not positions [OK]
Common Mistakes:
Confusing SUBSTITUTE with REPLACE
Thinking SUBSTITUTE works by position
Assuming SUBSTITUTE changes numbers
2. Which of these is the correct syntax for the REPLACE function in Google Sheets?
easy
A. REPLACE(text, start_num, num_chars, new_text)
B. REPLACE(text, old_text, new_text)
C. REPLACE(old_text, new_text, instance_num)
D. REPLACE(text, new_text, start_num)
Solution
Step 1: Recall REPLACE syntax
REPLACE requires the original text, the start position, number of characters to replace, and the new text.
Step 2: Check options
Only REPLACE(text, start_num, num_chars, new_text) matches this order and parameters correctly.
Final Answer:
REPLACE(text, start_num, num_chars, new_text) -> Option A
Quick Check:
REPLACE syntax = text, start, length, new text [OK]
Hint: REPLACE needs position and length, SUBSTITUTE needs old text [OK]
Common Mistakes:
Mixing parameter order
Using old_text instead of start_num
Omitting number of characters to replace
3. Given cell A1 contains the text "apple banana apple", what is the result of =SUBSTITUTE(A1, "apple", "orange", 2)?
medium
A. "orange banana orange"
B. "orange banana apple"
C. "apple banana orange"
D. "apple banana apple"
Solution
Step 1: Understand SUBSTITUTE with instance number
The formula replaces only the 2nd occurrence of "apple" with "orange".
Step 2: Apply replacement
First "apple" stays, second "apple" changes to "orange" resulting in "apple banana orange".
Final Answer:
"apple banana orange" -> Option C
Quick Check:
SUBSTITUTE replaces 2nd 'apple' only [OK]
Hint: Use 4th SUBSTITUTE argument to replace specific occurrence [OK]
Common Mistakes:
Replacing all occurrences instead of one
Replacing first occurrence by mistake
Confusing SUBSTITUTE with REPLACE
4. You want to replace the first 3 letters of the text in cell B2 with "XYZ". Which formula fixes the error in this incorrect formula: =SUBSTITUTE(B2, 1, 3, "XYZ")?
medium
A. =REPLACE(B2, "1", "3", "XYZ")
B. =REPLACE(B2, 1, 3, "XYZ")
C. =SUBSTITUTE(B2, "1", "XYZ", 3)
D. =SUBSTITUTE(B2, 3, 1, "XYZ")
Solution
Step 1: Identify misuse of SUBSTITUTE
SUBSTITUTE does not use position or length, so it cannot replace by position.
Step 2: Use REPLACE for position-based replacement
REPLACE takes start position, length, and new text, so =REPLACE(B2, 1, 3, "XYZ") is correct.
Final Answer:
=REPLACE(B2, 1, 3, "XYZ") -> Option B
Quick Check:
Use REPLACE for position-based text changes [OK]
Hint: Use REPLACE to change text by position, not SUBSTITUTE [OK]
Common Mistakes:
Using SUBSTITUTE with numbers as positions
Swapping parameters order
Using quotes incorrectly around numbers
5. You have a list of product codes in column A like "AB12345". You want to replace the first two letters with "X5" and also replace all occurrences of "5" with "9" in the same formula. Which formula achieves this?
hard
A. =SUBSTITUTE(REPLACE(A1, 1, 2, "X5"), "5", "9")
B. =REPLACE(SUBSTITUTE(A1, "5", "9"), 1, 2, "X5")
C. =SUBSTITUTE(A1, LEFT(A1, 2), "X5")
D. =REPLACE(A1, 1, 2, "X5") & SUBSTITUTE(A1, "5", "9")
Solution
Step 1: Replace first two letters with REPLACE
REPLACE(A1, 1, 2, "X5") changes first two letters to "X5".
Step 2: Replace all "5" with "9" using SUBSTITUTE
SUBSTITUTE(..., "5", "9") changes all 5's to 9's in the updated text.
Step 3: Combine functions correctly
Applying REPLACE first, then SUBSTITUTE on result is correct, matching =SUBSTITUTE(REPLACE(A1, 1, 2, "X5"), "5", "9").
Final Answer:
=SUBSTITUTE(REPLACE(A1, 1, 2, "X5"), "5", "9") -> Option A
Quick Check:
Chain REPLACE then SUBSTITUTE for combined changes [OK]
Hint: Nest REPLACE inside SUBSTITUTE to combine position and text changes [OK]
Common Mistakes:
Applying SUBSTITUTE before REPLACE causing wrong results
Concatenating results instead of nesting
Using SUBSTITUTE to replace by position
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.