HomeGoogle DocsSpreadsheetReplace Function in Google Sheets - Formula Examples

Replace Function in Google Sheets – Formula Examples

Published on

The REPLACE is a Text function. But you can replace part of a text, number or even a date with the Replace function in Google Sheets.

I have included enough formula examples for you to master this simple Text function.

Here is the Syntax:

REPLACE(text, position, length, new_text)

I don’t think I should explain about this function’s arguments. The example section below can shed light on that.

Formula Examples to the REPLACE Function in Google Sheets

Let’s begin with text replacing. Then you can learn how to replace part of numbers and dates.

How to Replace Part of Text Using the Replace Function in Google Sheets?

For the examples below, I am using the text in Cell A1 which is “Info Inspired Blog”.

1. The Replace Formula to Change the Last Part of the Text

This formula replaces the text “Blog” with “Website”.

=REPLACE(A1,15,4,"Website")

You can also use the text within the formula as below.

=REPLACE("Info Inspired Blog",15,4,"Website")

2. The Replace Formula to Change the Beginning of the Text

I am replacing the word “Info” at the beginning with the Replace function. You may please note that here I am just leaving the replace text as blank.

=REPLACE(A1,1,5,"")

Result: Inspired Blog

That means you can use Google Sheets Replace function to remove part of a string.

3. The Formula to Change Any Part of a Text

I am removing the text “inspired” which is in the middle of the text in A1.

=REPLACE(A1,5,9,"")

Result: Info Blog

4. Replace Texts in an Array Using the Replace Function in Google Sheets

See how I am replacing part of item codes in Column A with the Replace Array Function.

Replace Texts in an Array Using the Replace Function

How to Replace Part of a Number Using the Function Replace in Google Sheets?

Normally such replacement is not required. But I just want to tell you that you can replace part of any number too using the Replace function.

For this example, the value in cell A1 is 1555.

Here is the formula:

=REPLACE(A1,2,3,444)

In the last part, i.e. in the replace text, you can use/do not use the double quotes. It won’t affect the result.

Result: 1444

It preserves the number format too. But I recommend you to wrap this formula with the Value function as below.

=VALUE(REPLACE(A1,2,3,444))

How to Replace Part of a Date Using the Replace Function in Google Sheets?

You can replace, day, month, and year using the function Replace in Google Sheets. See the screenshot for formulas.

Replace Part of a Date Using the Replace Function

Similar to the number, this formula preserves the date formats. But when you use this formula output in other calculations, wrap the formula with the VALUE function as above.

Related:

1. Google Sheets Regexreplace Function How to and Examples

2. How to Use SUBSTITUTE Function in Google Sheets and Its Practical Use

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.