SUBSTITUTE replaces specific text in a string with new text. It changes all or selected occurrences of the old text without changing the rest of the 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, not by matching text. It replaces characters starting at a specific position with new text.
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: text to insert
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) This changes only the 2nd "apple" to "orange" resulting 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 starting at a specific position for a given length.
What does the optional 4th argument in SUBSTITUTE do?
ASpecifies the new text
BSpecifies the number of characters to replace
CSpecifies which occurrence of old text to replace
DSpecifies the start position
✗ Incorrect
The 4th argument tells SUBSTITUTE which occurrence of the old text to replace.
If you want to replace the first 3 characters in a string, which function and arguments would you use?
AREPLACE(text, 1, 3, new_text)
BSUBSTITUTE(text, old_text, new_text, 1)
CLEFT(text, 3)
DRIGHT(text, 3)
✗ Incorrect
REPLACE with start_num=1 and num_chars=3 replaces the first 3 characters.
What will =SUBSTITUTE("banana", "a", "o") return?
Abonono
Bbanana
Cbanano
Dbonana
✗ Incorrect
SUBSTITUTE replaces all occurrences of "a" with "o", so "banana" becomes "bonono".
Which function can replace only the 3rd occurrence of a word in a text?
AREPLACE
BLEFT
CRIGHT
DSUBSTITUTE with instance_num=3
✗ Incorrect
SUBSTITUTE lets you specify which occurrence to replace using the 4th argument.
Explain how SUBSTITUTE and REPLACE functions differ in Excel and give an example of when to use each.
Think about whether you want to replace by text match or by position.
You got /4 concepts.
Describe the syntax and purpose of the optional argument in SUBSTITUTE.
This argument controls how many replacements happen.
You got /3 concepts.
Practice
(1/5)
1. Which function would you use in Excel to replace all occurrences of the word apple with orange in a text string?
easy
A. REPLACE
B. SUBSTITUTE
C. CONCATENATE
D. LEFT
Solution
Step 1: Understand the function purpose
SUBSTITUTE replaces specific text by matching the exact word or phrase in the string.
Step 2: Compare with REPLACE
REPLACE changes text based on position, not matching text, so it is not suitable here.
Final Answer:
SUBSTITUTE -> Option B
Quick Check:
Replace by matching text = SUBSTITUTE [OK]
Hint: Use SUBSTITUTE to replace specific words by matching text [OK]
Common Mistakes:
Using REPLACE when you need to match text
Confusing SUBSTITUTE with CONCATENATE
Trying to use LEFT to replace text
2. Which of the following is the correct syntax to replace the first 3 characters in cell A1 with XYZ using the REPLACE function?
easy
A. REPLACE("XYZ", 1, 3, A1)
B. REPLACE(A1, "XYZ", 1, 3)
C. REPLACE(A1, 3, 1, "XYZ")
D. REPLACE(A1, 1, 3, "XYZ")
Solution
Step 1: Recall REPLACE syntax
REPLACE(text, start_num, num_chars, new_text) replaces characters starting at start_num for num_chars length.
Step 2: Match syntax to question
To replace first 3 characters in A1 with "XYZ", start_num=1, num_chars=3, new_text="XYZ".
Final Answer:
REPLACE(A1, 1, 3, "XYZ") -> Option D
Quick Check:
REPLACE(text, 1, 3, "XYZ") correct syntax [OK]
Hint: REPLACE(text, start, length, new_text) replaces by position [OK]
Common Mistakes:
Swapping start_num and num_chars
Putting new_text in wrong position
Using SUBSTITUTE syntax for REPLACE
3. What will be the result of the formula =SUBSTITUTE("banana", "a", "o", 2)?
medium
A. "bonana"
B. "banana"
C. "banona"
D. "bonono"
Solution
Step 1: Understand SUBSTITUTE with instance number
SUBSTITUTE(text, old_text, new_text, instance_num) replaces only the specified occurrence.
Step 2: Apply to "banana" replacing 2nd "a" with "o"
"banana" has 'a' at positions 2, 4, and 6. The 2nd 'a' is at position 4, replaced by 'o' gives "banona".
Final Answer:
"banona" -> Option C
Quick Check:
Replace 2nd 'a' with 'o' = "banona" [OK]
Hint: SUBSTITUTE with instance replaces only that occurrence [OK]
Common Mistakes:
Replacing all 'a's instead of just the 2nd
Confusing instance number with position
Expecting REPLACE to work by matching text
4. The formula =REPLACE(A1, 2, 3, "XYZ") returns an error. Which is the most likely cause?
medium
A. The start position 2 is greater than the length of text in A1
B. Cell A1 is empty
C. The number of characters to replace is negative
D. The new text "XYZ" is too long
Solution
Step 1: Check REPLACE parameters
REPLACE(text, start_num, num_chars, new_text) requires start_num within text length.
Step 2: Identify error cause
If start_num (2) is greater than text length, REPLACE cannot start and returns error.
Final Answer:
The start position 2 is greater than the length of text in A1 -> Option A
Quick Check:
Start position must be within text length [OK]
Hint: Start position must be inside text length for REPLACE [OK]
Common Mistakes:
Assuming empty cell causes error
Thinking new text length matters
Using negative number of characters
5. You have the text "Invoice12345" in cell A1. Which formula will replace the numeric part with "67890" regardless of how many digits the number has?
hard
A. REPLACE(A1, 8, LEN(A1)-7, "67890")
B. SUBSTITUTE(A1, "12345", "67890")
C. REPLACE(A1, 8, 5, "67890")
D. SUBSTITUTE(A1, MID(A1,8,5), "67890")
Solution
Step 1: Identify numeric part position and length
The text "Invoice12345" has "Invoice" (7 chars) then numbers starting at position 8. Length of numbers is LEN(A1)-7.
Step 2: Use REPLACE with dynamic length
REPLACE(A1, 8, LEN(A1)-7, "67890") replaces from position 8 for all digits, no matter how many.
Final Answer:
REPLACE(A1, 8, LEN(A1)-7, "67890") -> Option A
Quick Check:
Dynamic length replace = REPLACE with LEN() [OK]
Hint: Use LEN() to replace variable-length text with REPLACE [OK]
Common Mistakes:
Hardcoding length instead of using LEN()
Using SUBSTITUTE which needs exact text match
Using MID inside SUBSTITUTE incorrectly
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.