<< Go back to all functions

REPLACE

The REPLACE function in Google Sheets allows you to replace part of a text string with a different text string. This can be useful for modifying existing text or fixing errors. Learn how to use the REPLACE function with our comprehensive guide.

Function Syntax and Parameters

Syntax: REPLACE(text, position, length, new_text)

Parameters:

  • text: The original text string.
  • position: The position within the original text string where the replacement should start. Use 1 for the first character.
  • length: The number of characters to replace.
  • new_text: The new text string to insert in place of the replaced text.

Step-by-Step Tutorial

  1. Replacing a portion of text:

    • Example: =REPLACE("Hello, World!", 8, 5, "Universe")
    • Result: Hello, Universe!
  2. Removing a portion of text:

    • Example: =REPLACE("Hello, World!", 8, 6, "")
    • Result: Hello!

Use Cases and Scenarios

  1. Data Cleaning: Remove unnecessary characters or fix formatting errors in a dataset.
  2. String Manipulation: Modify text strings to fit specific requirements or formatting rules.
  3. Document Editing: Replace words or phrases in a document without manually editing each occurrence.

Related Functions

  • SUBSTITUTE: Replace specific text within a string.
  • LEFT and RIGHT: Extract characters from the beginning or end of a text string.

Related Articles