0
0
Excelspreadsheet~5 mins

SUBSTITUTE and REPLACE in Excel - Step-by-Step Guide

Choose your learning style9 modes available
Introduction
These two functions help you change text inside a cell. SUBSTITUTE replaces specific text you choose, while REPLACE changes text based on position. They solve the problem of fixing or updating parts of text without rewriting everything.
When you want to change all occurrences of a word in a list of product names.
When you need to fix a typo that appears multiple times in a text column.
When you want to replace a part of a phone number or code based on its position.
When you want to update a date format by replacing characters at certain positions.
When you want to remove or change a specific word inside a sentence without affecting others.
Steps
Step 1: Click
- cell where you want the result
The cell is selected and ready for typing a formula
Step 2: Type
- formula bar
You start entering the formula
💡 Start with =SUBSTITUTE( or =REPLACE( to see the function help
Step 3: For SUBSTITUTE, type
- formula bar
Formula looks like =SUBSTITUTE(text, old_text, new_text, [instance_num])
💡 Text is the cell with original text, old_text is what to replace, new_text is replacement, instance_num is optional to replace only one occurrence
Step 4: For REPLACE, type
- formula bar
Formula looks like =REPLACE(old_text, start_num, num_chars, new_text)
💡 old_text is original text, start_num is position to start replacing, num_chars is how many characters to replace, new_text is replacement text
Step 5: Press Enter
- formula bar
The cell shows the text with replacements applied
Step 6: Copy the formula down
- cells below
All rows update with replaced text based on each row's original text
Before vs After
Before
Cell A2 contains 'apple banana apple', cell A3 contains '1234567890'
After
Using =SUBSTITUTE(A2, "apple", "orange") shows 'orange banana orange' in B2; Using =REPLACE(A3, 4, 3, "XYZ") shows '123XYZ7890' in B3
Settings Reference
old_text
📍 Inside SUBSTITUTE formula
Text you want to replace
Default: Required
new_text
📍 Inside SUBSTITUTE or REPLACE formula
Text to replace with
Default: Required
instance_num
📍 Inside SUBSTITUTE formula
Which occurrence of old_text to replace
Default: All occurrences replaced if omitted
start_num
📍 Inside REPLACE formula
Position in text to start replacing
Default: Required
num_chars
📍 Inside REPLACE formula
How many characters to replace
Default: Required
Common Mistakes
Using REPLACE when you want to replace text by matching words
REPLACE works by position, so it may replace wrong characters if text length changes
Use SUBSTITUTE to replace specific words or text strings
Omitting instance_num in SUBSTITUTE when only one occurrence should change
All occurrences get replaced, which may not be desired
Specify the instance_num argument to replace only the needed occurrence
Using wrong start_num or num_chars in REPLACE causing unexpected text changes
Positions are counted from left, so wrong numbers replace wrong parts
Count characters carefully and test with sample text before applying
Summary
SUBSTITUTE replaces specific text by matching words or phrases.
REPLACE changes text based on position and length inside the string.
Use SUBSTITUTE for word-based changes and REPLACE for position-based edits.