SUBSTITUTE Function
SUBSTITUTE replaces specific text within a string with new text.
Syntax
Parameters
| Parameter | Description | Required |
|---|---|---|
| text | The text string in which to substitute characters. | Required |
| old_text | The text to find and replace. | Required |
| new_text | The text to replace old_text with. | Required |
| instance_num | Optional. Which occurrence of old_text to replace. | Optional |
Basic Example
Replace all occurrences
=SUBSTITUTE("apple, apple, banana", "apple", "orange")Replaces all instances of "apple" with "orange".
Advanced Examples
Example 1: Replace only the first occurrence
Selective replacementReplace just the first instance of text
=SUBSTITUTE("apple, apple, banana", "apple", "orange", 1)Example 2: Remove all spaces
Text cleaningDelete all spaces from a text string
=SUBSTITUTE(A1, " ", "")How SUBSTITUTE Works
SUBSTITUTE searches for old_text in the text string and replaces it with new_text. If instance_num is specified, only that occurrence is replaced.
Important Notes & Limitations
SUBSTITUTE is case-sensitive.
For case-insensitive replacement, use UPPER/LOWER with SUBSTITUTE, or use REPLACE for position-based replacement.
Common Errors & Fixes
#VALUE!Invalid argumentsFix: Ensure all required arguments are provided.
Download Practice File
SUBSTITUTE
substitutePractice SUBSTITUTE with Real Data
Download a sample CSV file with pre-populated data and practice exercises for the SUBSTITUTE function. Works in both Excel and Google Sheets.
File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps