HomeGoogle DocsSpreadsheetHow to Use SUBSTITUTE Function in Google Sheets and Its Practical Use

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

Published on

Like any other text functions, SUBSTITUTE Function is also pretty easy to use in Google Sheets. I can’t exactly say how useful this function is as it depends on the user. Anyway, I will try to provide you few real-life uses of SUBSTITUTE formula in Google Doc Spreadsheets.

The Syntax of Google Sheets SUBSTITUTE Function

The use of SUBSTITUTE function is to substitute existing text with new text in a string. So you can use SUBSTITUTE formula to clean texts or sentences.

Syntax: SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number])

Example:

1. Replace DOB with Date of Birth in the below text using SUBSTITUTE.

The value in Cell A1 for the example is “His DOB is 26-11-2017”.

Formula: =SUBSTITUTE(A1,”DOB”,”Date of Birth”)
Result: His Date of Birth is 26-11-2017

2. Remove a Text from a sentence using SUBSTITUTE.

The value in Cell A1: Our Office is Off on coming Saturday, Sunday, and Monday

Formula: =SUBSTITUTE(A1,” , and Monday”,””)
Result: Our Office is Off on coming Saturday, Sunday

3. Multiple SUBSTITUTE Formula or Nested SUBSTITUTE.

The value in Cell A1: Our Office is Off on coming Saturday, Sunday, and Monday

Formula: =SUBSTITUTE(SUBSTITUTE(A1,” , and Monday”,“”),“,”,” &”)
Result: Our Office is Off on coming Saturday & Sunday

4. Remove Double Quotes Using SUBSTITUTE [Remove Special Characters]

The value in Cell B2: “India is My Country”

Formula: =SUBSTITUTE(B2,CHAR(34),“”)
Result: India is My Country

Formula: =SUBSTITUTE(B2,CHAR(34),“”,1)
Result: India is My Country”

Formula: =SUBSTITUTE(B2,CHAR(34),“”,2)
Result: “India is My Country

I’ve used the CHAR function in the above example.

Now a Practical Example to the Use of Google Sheets SUBSTITUTE function.

Google Sheets SUBSTITUTE Function with ARRAYFORMULA

Few candidates are shortlisted and scheduled for a final interview. Under “Modified Status” in column D I’ve applied a formula as below.

=ArrayFormula(if(date(2017,11,15)<=today(),
SUBSTITUTE(C3:C,”Scheduled on 15/11/2017″,”Postponed to 15/12/2017″)))

I’ve used IF logical, ARRAYFORMULA and SUBSTITUTE functions in a combined form here.

What is the purpose of this lengthy formula?

The above formula checks whether today’s date is less than or equal to 15/11/2017, that is the interview scheduled date.

If it’s true, the Substitute formula replaces the scheduled date with a new postponed date.

As per this post date, the condition matches for the first row. So the formula postponed the interview date in Column D.

Practical Example to the Use of Google Sheets SUBSTITUTE function

This way you can use SUBSTITUTE function in combination with other functions in Google Sheets.

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.

Get Top N Values Using Excel’s FILTER Function

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

XLOOKUP in Excel: Working with Visible Rows in a Table

In Excel, the XLOOKUP function isn't inherently designed to exclusively work with visible rows;...

SUMPRODUCT Differences: Excel vs. Google Sheets

The core purpose of the SUMPRODUCT function remains consistent across both Excel and Google...

Sum Values by Month and Category in Excel

With the help of EOMONTH, UNIQUE, and SUMIFS functions in Excel, you can efficiently...

More like this

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...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

4 COMMENTS

  1. Hi,

    How do replace a value and have the replacement appear in the same box that the value initially was? I notice that Substitute always shows up in its own box. For example, I have 0 in box A1 and want to replace 0 with 1 so that box A1 becomes 1. I want to do this on a very large scale and need to do it with formulas. Do you have any suggestions?

    Thanks.

  2. Hi There:

    I have a cell that has two texts that I need to eliminate to obtain a number; for instance, US$250.00$, I want to substitute “US$” and “$” all at once.

    I have been able to do it separately using the following formulas =SUBSTITUTE(H4,"US$","") and =SUBSTITUTE(I4,"$","").

    I would like to know if I can combine both formulas into one to make the work easier.

    Thanks

    • Hi, Cruz A Villasana,

      You can either nest the two Substitute formulas or use a Regexreplace formula instead.

      Using Substitute:

      =substitute(SUBSTITUTE(H4,"US$",""),"$","")*1

      Using Regexreplace:

      =REGEXREPLACE(H4, "[^\d\.-]+", "")*1

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.