Complete the formula to replace all occurrences of "cat" with "dog" in cell A1.
=SUBSTITUTE(A1, [1], "dog")
The SUBSTITUTE function replaces all occurrences of the text you specify. Here, you want to replace "cat" with "dog".
Complete the formula to replace only the second occurrence of "apple" with "orange" in cell B2.
=SUBSTITUTE(B2, "apple", [1], 2)
The third argument in SUBSTITUTE is the replacement text. To replace the second occurrence, specify 2 as the fourth argument.
Fix the error in the formula to replace the first 3 characters in cell C3 with "XYZ".
=REPLACE(C3, 1, [1], "XYZ")
The REPLACE function replaces a number of characters starting at a position. Here, you want to replace 3 characters starting at position 1.
Fill both blanks to create a formula that replaces the 4 characters starting at position 2 in cell D4 with "test".
=REPLACE(D4, [1], [2], "test")
The second argument is the start position (2), and the third argument is the number of characters to replace (4).
Fill all three blanks to create a formula that substitutes "red" with "blue" only in the third occurrence in cell E5, then replaces the first 2 characters of the result with "Hi".
=REPLACE(SUBSTITUTE(E5, [1], [2], [3]), 1, 2, "Hi")
The SUBSTITUTE replaces the third occurrence of "red" with "blue". Then REPLACE changes the first 2 characters to "Hi".