To replace a string of text in Excel, use the SUBSTITUTE function if you know the specific text you want to change, or the REPLACE function if you know the exact position of the text you want to swap. While both functions modify strings, SUBSTITUTE looks for a specific sequence of characters regardless of where they appear, whereas REPLACE swaps characters based on their numerical location within the cell.

What You'll Need

  • A computer with Microsoft Excel installed (all modern versions including Office 365, Excel 2021, 2019, and 2016).
  • A dataset containing the text strings you wish to modify.
  • A basic understanding of how to enter formulas into a cell.

Step-by-Step

Method 1: Using the SUBSTITUTE Function

Use this method when you want to replace a specific word or character with something else, regardless of where it sits in the text. For example, changing "Street" to "St." across a whole column of addresses.

  1. Click on the empty cell where you want the corrected text to appear.
  2. Type =SUBSTITUTE( to begin the function.
  3. Select the cell containing the original text (e.g., A2). This is the text argument.
  4. Type a comma, then type the text you want to remove inside double quotation marks (e.g., ", "Street","). This is the old_text argument.
  5. Type another comma, then type the new text you want to insert, also inside double quotation marks (e.g., "St."). This is the new_text argument.
  6. (Optional) Type a comma and a number if you only want to replace a specific occurrence of the text. For example, if a cell says "Red Car, Red House" and you only want to change the first "Red", enter 1. If left blank, Excel replaces every instance.
  7. Close the parenthesis ) and press Enter.
  8. Drag the fill handle (the small square at the bottom-right of the cell) downward to apply the formula to the rest of your column.

Method 2: Using the REPLACE Function

Use this method when the text you want to change is always in the same spot, but the actual characters might vary. For example, replacing the first three digits of a product code with a new prefix.

  1. Click on the empty cell where you want the result to appear.
  2. Type =REPLACE( to begin the function.
  3. Select the cell containing the original text (e.g., B2). This is the old_text argument.
  4. Type a comma, then enter the starting position of the text you want to replace. For example, if you want to start at the first character, type 1. This is the start_num argument.
  5. Type a comma, then enter the number of characters you want to remove. For example, if you are replacing a 3-digit code, type 3. This is the num_chars argument.
  6. Type a comma, then type the new text inside double quotation marks (e.g., "NEW-"). This is the new_text argument.
  7. Close the parenthesis ) and press Enter.
  8. Drag the fill handle down to apply the formula to other rows.

Method 3: Using Find and Replace (Non-Formula)

If you do not need a dynamic formula and simply want to change the data permanently in the cells, use the built-in tool.

  1. Highlight the range of cells you wish to modify.
  2. Press Ctrl + H on your keyboard.
  3. In the "Find what" box, type the string you want to remove.
  4. In the "Replace with" box, type the new string.
  5. Click "Replace All" to update every instance in the selection instantly.

Common Mistakes

One of the most frequent errors is forgetting the double quotation marks. In Excel formulas, any text (string) must be enclosed in quotes (e.g., "Text"). If you type =SUBSTITUTE(A1, Street, St.) without quotes, Excel will look for a named range called "Street" and return a #NAME? error because it cannot find it.

Another common mistake is ignoring case sensitivity. The SUBSTITUTE function is case-sensitive. If you tell Excel to replace "apple" with "orange", but your cell contains "Apple" (capital A), Excel will not find a match and will leave the text unchanged. To fix this, ensure your search string matches the casing of your data exactly.

Users also often confuse the start_num and num_chars in the REPLACE function. Remember that start_num is the index of the character where the change begins, and num_chars is the length of the segment being deleted. If you set num_chars too high, you will accidentally delete more of your string than intended.

Tips

Nesting Functions: You can nest multiple SUBSTITUTE functions to replace several different strings at once. For example, if you want to remove parentheses and dashes from a phone number, you can use: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1, "(", ""), ")", ""), "-", ""). This works from the inside out, cleaning the text in stages.

Dynamic References: Instead of typing the replacement text directly into the formula, reference another cell. For example, =SUBSTITUTE(A2, B2, C2). This allows you to change the "find" and "replace" terms in cells B2 and C2 without having to edit the formula in every single row.

Combining with LEN: If you need to replace text at the end of a string but the strings are of different lengths, combine REPLACE with the LEN function. Using LEN(A2)-3 as the start number allows you to target the last three characters of any cell regardless of its total length.

Troubleshooting

The formula returns the original text without any changes: This usually happens because of case sensitivity in the SUBSTITUTE function. Check if your data has capital letters that your formula does not. If you need a case-insensitive replacement, you can wrap the text in the UPPER function: =SUBSTITUTE(UPPER(A2), "OLD", "NEW"), though this will make the entire output uppercase.

The formula returns a #VALUE! error: This often occurs in the REPLACE function if the start_num is less than 1 or if the num_chars argument is a negative number. Double-check your numeric inputs to ensure they are positive integers.

The result is a formula, but I want the actual text: Because these are functions, the cell displays the result of a calculation. To turn these into permanent text, select the cells, copy them (Ctrl + C), right-click on the destination cells, and select Paste Values (the icon with "123"). This removes the formula and keeps only the final string.

Unexpected characters are being deleted: Check your num_chars count in the REPLACE function. Remember that spaces count as characters. If your string is "John Doe" and you start at position 1 and replace 5 characters, you have replaced "John " (including the space).

Frequently Asked Questions

Can I replace a string with nothing?

Yes. To delete a string entirely, use empty double quotes "" as the new_text argument. For example, =SUBSTITUTE(A1, "-", "") will remove all dashes from the cell.

Is there a limit to how many replacements SUBSTITUTE can do?

There is no hard limit on the number of replacements a single SUBSTITUTE function can perform across a cell, but it can only handle one specific "find/replace" pair per function call. For multiple different pairs, you must nest the functions.

Does REPLACE change the original data?

No. Formulas in Excel never change the source data in the referenced cell; they output the result into a new cell. Only the "Find and Replace" tool (Ctrl+H) modifies the original data directly.

How do I replace a line break or a carriage return?

You can use the CHAR function. In Windows, a line break is usually represented by CHAR(10). To replace it with a space, use =SUBSTITUTE(A1, CHAR(10), " ").

Can I use wildcards like * or ? in SUBSTITUTE?

No, the SUBSTITUTE and REPLACE functions do not support wildcards. They require exact character matches. If you need wildcard replacement, you may need to use a combination of SEARCH and REPLACE, or use Power Query.

What is the difference between REPLACE and SUBSTITUTE again?

SUBSTITUTE is for when you know what the text is (e.g., "Replace 'Red' with 'Blue'"). REPLACE is for when you know where the text is (e.g., "Replace the 2nd through 5th characters with 'Blue'").