1. Home
  2. Functions
  3. Text
  4. REPLACE

REPLACE function

Replaces part of a text, given a start position and a number of characters, with other text.

Syntax

=REPLACE(old_text, start_num, num_chars, new_text)

Arguments

ArgumentRequiredDescription
old_textRequiredThe text to change
start_numRequiredPosition of the first character to replace
num_charsRequiredHow many characters to replace
new_textRequiredThe text to put in

How to use REPLACE

REPLACE takes 4 required arguments. Type =REPLACE( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=REPLACE("abcdefghijk", 6, 5, "*")Result "abcde*k"
=REPLACE("2009", 3, 2, "10")Result "2010"

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.