Excel REPLACE Function: Syntax, Examples & Tips

The REPLACE function in Excel modifies text by replacing specified characters with new ones, streamlining text editing tasks.
Excel
=REPLACE(old_text, start_num, num_chars, new_text)

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

Need more than a single REPLACE formula? Try our free AI for Excel — it reads your entire spreadsheet, answers questions in plain English, and builds charts and analysis in the same chat.

On this page
  1. Parameters
  2. What is a REPLACE Formula in Excel?
  3. A Practical Example
  4. REPLACE Formula
  5. Result of the Formula
  6. Why Use REPLACE?
  7. Key Takeaways:
  8. Example use case

Parameters

old_text:
The original text string that you want to modify.

start_num:
The position in the old_text where the replacement will begin. The first character in the string is position 1.

num_chars:
The number of characters in the old_text that you want to replace, starting from the start_num.

new_text:
The text that will replace the specified characters in the old_text.

What is a REPLACE Formula in Excel?

The REPLACE function in Excel is a versatile tool that allows you to substitute part of a text string with another text string. It is particularly useful when you need to modify specific characters or segments of text within a cell, making it easier to clean up or format data.

In simpler terms, the REPLACE function helps you change specific parts of text based on their position, allowing for efficient text manipulation.

A Practical Example

Imagine you have a list of product codes in an Excel spreadsheet, and you need to update the codes to reflect a new format:

Product Codes Table:

Product Code
ABC-1234
DEF-5678
GHI-9101
JKL-1121
MNO-3141

You want to replace the first three characters of each product code with "XYZ".

REPLACE Formula

To update the product codes, you would use the REPLACE formula as follows:

Excel
=REPLACE(A2, 1, 3, "XYZ")

Breakdown of the Formula:

  • A2: This is the cell containing the original text (product code).
  • 1: This is the starting position in the text string where the replacement will begin.
  • 3: This is the number of characters to replace.
  • "XYZ": This is the new text that will replace the specified characters.

Result of the Formula

When you apply the formula to the first product code, it changes "ABC-1234" to "XYZ-1234". If you drag the formula down to apply it to the other product codes, the output would be:

Updated Product Code
XYZ-1234
XYZ-5678
XYZ-9101
XYZ-1121
XYZ-3141

Here, all product codes have been updated to reflect the new format.

Why Use REPLACE?

The REPLACE function is particularly useful when you need to standardize or modify text data without having to manually edit each entry. It allows for quick and efficient text changes, saving time and reducing errors.

Key Takeaways:

  • REPLACE: Substitutes part of a text string with another text string based on position.
  • Efficient Text Manipulation: Helps you quickly modify text without manual editing.
  • Common Use Cases: Ideal for updating codes, formatting data, and cleaning up text entries.

Understanding how to use the REPLACE function can significantly enhance your data management capabilities in Excel, enabling you to efficiently manipulate and format text data.

Happy replacing!

Example use case

You have a list of product codes in Column A that include a mix of letters and numbers, but you need to standardize them by replacing a specific character (e.g., replacing "X" with "Y"). You can use the REPLACE function to modify the product codes efficiently. This allows for consistent formatting across your inventory, making it easier to manage and track products without manually editing each entry.

Beyond the REPLACE function: Better Analyst is a full Excel AI that goes well past individual formulas. Upload any spreadsheet and ask questions in plain English — you'll get formulas, data analysis, and charts back in seconds. It's a free AI Excel assistant that works with any .xlsx, .xls, or .csv file — no plugins, no Microsoft 365 required.

Don't have a spreadsheet yet? Use our free AI spreadsheet generator to turn a text prompt into a downloadable Excel file — a full AI Excel sheet maker that builds headers, columns, and formulas from your description.

Need more help with Excel formulas?

Create a free account for formula help, explanations, and spreadsheet analysis. Usage limits depend on your plan.

Explore all Excel formulas

Browse our complete library of Excel formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.