EZ TuitionsAll tuitions

Google Sheets SUBSTITUTE Function for Schoolwork

To replace text inside a cell, type =SUBSTITUTE(A2,"/",", ") in a blank cell. It replaces every slash in A2 with a comma and a space. Add a fourth number to replace only that occurrence. Check the result and the source cell afterwards.

Start with a blank practice sheet you own

Use a new blank Google Sheet you own, on a computer. Keep it unshared. Check the account, the file title and your editing access first. Do not use a real class sheet, a gradebook, a list of real names or a quotation you must keep exact.

This guide uses one fictional text value and two formulas. Put each formula in its own blank cell, away from the source, and leave the source cell as it is.

This guide teaches only SUBSTITUTE with a quoted separator. It does not teach VALUE conversion, nesting, regular expressions, REPLACE, copying a formula down, whole columns, overwriting source data, number, date or ID cleanup, locale settings, or spelling correction.

Set out the fictional text

In the blank sheet, type Asha/Meera/Ravi in cell A2. It is a fictional class list with a slash between names. Leave every other cell blank.

The plan is two formulas. The first, in C2, should turn every slash into a comma and a space. The second, in D2, should change only the second slash. The expected results are Asha, Meera, Ravi and Asha/Meera, Ravi. These are this guide's own derived expectations and were not run in Sheets.

Enter the two formulas

  1. Check that A2 holds Asha/Meera/Ravi and that C2 and D2 are blank.
  2. Select C2, type =SUBSTITUTE(A2,"/",", ") with the quotes and the space after the comma inside the last pair, and press Enter.
  3. Check that C2 shows Asha, Meera, Ravi.
  4. Select D2, type =SUBSTITUTE(A2,"/",", ",2) and press Enter.
  5. Check that D2 shows Asha/Meera, Ravi.
  6. Do not copy either formula down, and do not type over A2.

Google gives the form SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number]), says all occurrences are replaced by default, and says a given occurrence_number replaces only that instance. Google's page does not give this class-list example.

Spreadsheet Tutorials and SheetError describe typing such formulas into blank cells of a practice sheet and comparing the result with an expected value. Neither they nor Google's page mention pressing Enter. Pressing Enter to finish a formula is this guide's own procedural instruction. Both are secondary pages, and this guide did not run their sheets.

Check the cells

Do not edit a result by hand to match the expected text. If a result is still different, stop and ask the owner. Do not overwrite A2 to try again.

Know what SUBSTITUTE does and does not do

Google says search_for matches parts of words as well as whole words, so a search for vent also replaces text within eventual. This guide uses a slash between whole names and does not teach whole-word replacement.

Google also says SUBSTITUTE returns text, and cannot replace several but not all instances in one call. Google's page does not state whether capitalization must match. This guide uses text that matches exactly and teaches no case rule.

A change of separator can merge or alter real values, so this guide does not apply it to real names, quotations, grades or identifiers. The sample uses fictional names and only the separator changes. These steps were not run in Sheets.

Check the practice result only

This guide covers only the fictional A2, C2 and D2 cells. It did not clean a real list, change a real sheet or check any teacher's required format, and it did not verify any step in Sheets.

canispreadsheet says SUBSTITUTE finds text you name while REPLACE changes a position, and Google lists REPLACE as a separate function. This guide does not teach REPLACE. These are source checks, not a hands-on Sheets or student-account test. No grade or time saving is promised.

Common questions

How do I replace text inside a cell with SUBSTITUTE?

In a blank cell, type SUBSTITUTE with the cell, the text to find and the new text, then press Enter. Google says all matches are replaced by default. This guide's example is derived and was not run in Sheets.

How do I replace only one match?

Add a fourth number. Google says a given occurrence_number replaces only that instance of the text. In this guide the number 2 changes only the second slash, as a derived expectation that was not run in Sheets.

Will SUBSTITUTE also change part of a longer word?

Google says search_for matches parts of words as well as whole words. Its example is that a search for vent also replaces text within eventual. This guide teaches only a separator between whole names.

Why put each formula in its own blank cell?

So the source cell stays as typed and you can compare it with each result. This guide checks A2 afterwards and does not type over it. It does not teach copying formulas down or whole columns.

Is SUBSTITUTE the same as REPLACE?

No. Google lists them as separate functions. canispreadsheet says SUBSTITUTE finds text you name and REPLACE changes a position. This guide does not teach REPLACE.

Sources and scope

Sources checked . Google controls the SUBSTITUTE syntax, the default of replacing all matches, the occurrence number, partial-word matching and the text result. The other pages are secondary and support context only. Their wording is not Google confirmation.