Substitutes new_text for old_text in a text string. Essential for text replacement, data cleaning, and text manipulation in Excel.
Master the fundamentals of Excel SUBSTITUTE function
The SUBSTITUTE function is Excel's text replacement tool that replaces old_text with new_text in a text string. It's essential for text manipulation, data cleaning, and text formatting tasks.
Replaces old text with new text
Replaces all occurrences by default
Can replace specific occurrence
Replacement is case sensitive
Function-specific parameters
Function-specific return type
Clean and standardize text data
Format text with proper characters
Process and transform text data
Generate formatted reports
Exact matching required
Returns numeric position
Handles missing text gracefully
=SUBSTITUTE(text, old_text, new_text, instance_num)The text string to substitute in
The text to be replaced
The text to replace old_text with
Which occurrence to replace (default: all occurrences)
Text with substitutions made
Description: Substitutes new_text for old_text in a text string
Replace text in a string
Replaces 'World' with 'Excel' in the text
Simple VBA implementation of SUBSTITUTE function
' Basic SUBSTITUTE in VBA
Range("C1").Value = Application.WorksheetFunction.Substitute(Range("A1").Value, "old", "new")
' Using VBA SUBSTITUTE function
Dim result As String
result = Application.WorksheetFunction.Substitute("Hello World", "World", "Excel")
' Loop through range and substitute text
Sub SubstituteText()
Dim cell As Range
For Each cell In Range("A1:A10")
If Not IsEmpty(cell.Value) Then
cell.Value = Application.WorksheetFunction.Substitute(cell.Value, "old", "new")
End If
Next cell
End SubClean and standardize text data
Format text with proper characters
Process and transform text data
Generate formatted reports
SUBSTITUTE returns original text when old_text not found
=SUBSTITUTE("Hello", "hello", "Hi")Solution: Check that old_text exactly matches the text in the string
SUBSTITUTE is case sensitive
=SUBSTITUTE(UPPER(A1), "HELLO", "HI")Solution: Use UPPER or LOWER functions to standardize case first