Google Sheets: remove the same text or certain characters from multiple cells at once

Learn formulas and formula-free ways to trim whitespaces, remove special symbols (even the first/last N characters) and the same text strings before/after certain chars from multiple cells at once.

Removing the same part of the text from several cells at once can be as important and tricky as adding it. Even if you know some of the ways, you will definitely find new ones in today's blog post. I share plenty of functions and their ready-made formulas and, as always, I save the easiest — formula-free — for last ;)

Formulas for Google Sheets to remove text from cells

I'm going to start with the standard functions for Google Sheets that will remove your text strings and characters from cells. There's no universal function for this, so I will provide different formulas and their combinations for various cases.

Google Sheets: remove whitespace

Whitespace can easily slip into cells after the import or if multiple users edit the sheet at the same time. In fact, extra spaces are so common that Google Sheets has a special Trim tool to remove all whitespaces.

Just select all Google Sheets cells where you want to remove whitespace and choose Data > Trim whitespace in the spreadsheet menu:
Find the Trim whitespace tool in the Google Sheets menu.
As you click the option, all leading and trailing spaces in the selection will be taken away completely while all extra spaces in-between the data will be reduced to one:
How Google Sheets removes whitespaces.

Remove other special characters from text strings in Google Sheets

Alas, Google Sheets doesn't offer a tool to 'trim' other characters but spaces. You have to deal with formulas here.

Tip. Or use our tool instead — Power Tools will free your range from any characters you specify in a click, including whitespace.

Here I have addressed with hashtags before the apartment numbers and phone numbers with dashes and brackets in-between:
Sample data with various special characters.
I will use formulas to remove those special characters.

The SUBSTITUTE function will help me with that. It is normally used to replace one character with another, but you can turn that to your advantage and replace the unwanted characters with… well, nothing :) In other words, remove it.

Let's see what argument the function requires:

SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number])
  • text_to_search is either the text to process or a cell that contains that text. Required.
  • search_for is that character that you want to find and delete. Required.
  • replace_with — a character you will insert instead of the unwanted symbol. Required.
  • occurrence_number — if there are several instances of the character you're looking for, here you can specify which one to replace. It's completely optional, and if you omit this argument, all instances will be replaced with something new (replace_for).

So let's play. I need to find a hashtag (#) in A1 and replace it with 'nothing' which is marked in spreadsheets with double quotes (""). With all that in mind, I can build the following formula:

=SUBSTITUTE(A1,"#","")

Tip. The hashtag is also in double quotes since this is the way you should mention text strings in Google Sheets formulas.

Then copy this formula down the column if Google Sheets doesn't offer to do that automatically, and you'll get your addresses without the hashtags:
Remove hashtags from Google Sheets cells.
But what about those dashes and brackets? Should you create additional formulas? Not at all! If you nest multiple SUBSTITUTE functions in one Google Sheets formula, you will remove all these characters from each cell:

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"#",""),"(",""),")",""),"-","")

This formula removes characters one by one and each SUBSTITUTE, starting from the middle, becomes the range to look at for the next SUBSTITUTE:
Remove characters from strings in all cells in Google Sheets.

Tip. What's more, you can wrap this in ArrayFormula and cover the entire column at once:

=ArrayFormula(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1:A7,"#",""),"(",""),")",""),"-",""))

Remove specific text from cells in Google Sheets

Although you can use the aforementioned SUBSTITUTE function for Google Sheets to remove text from cells, I'd like to show another function as well — REGEXREPLACE.

Its name is an acronym from 'regular expression replace'. And I'm going to use the regular expressions to search for the strings to remove and replace them with 'nothing' ("").

Tip. If you're not interested in using regular expressions, I describe a much easier way at the end of this blog post.
REGEXREPLACE(text, regular_expression, replacement)

As you can see, there are three arguments to the function:

  • text — is where you're looking for the text string to remove. It can be the text itself in double quotes or a reference to a cell/range with text.
  • regular_expression — your search pattern that consists of various character combinations. You'll be looking for all strings that match this pattern. This argument is where all the fun happens, if I may say so.
  • replacement — a new desired text string.

Let's suppose my cells with data also contain the country name (US) if different places in cells:
When the same text string is in a different position in each cell.
How will REGEXREPLACE help me remove it?

=REGEXREPLACE(A1,"(.*)US(.*)","$1 $2")

Google Sheets: remove the same text from all cells at once.
Here's how the formula works exactly:

  • it scans the contents of the cell A1
  • for matches to this mask: "(.*)US(.*)"

    This mask tells the function to look for the US no matter what number of other characters may precede (.*) or follow (.*) the name of the country.

    And the entire mask is put to double quotes per the function demands :)

  • the last argument — "$1 $2" — is what I want to get instead.$1 and $2 each represent one of those 2 groups of characters — (.*) — from the previous argument. You should mention those groups in the third argument this way so the formula could return everything that possibly stands before and after the US

    As for the US itself, I simply don't mention it in the 3rd argument — meaning, I want to return everything from A1 without the US.

Tip. There's a special page you can reference to build various regular expressions and look for the text in different positions of cells.
Tip. As for those remaining commas, the SUBSTITUTE function described above will help to get rid of them ;) You can even enclose REGEXREPLACE with the SUBSTITUTE and solve everything with one formula:

=SUBSTITUTE(REGEXREPLACE(A1,"(.*)US(.*)","$1 $2"),",","")

Remove text before/after certain characters in all selected cells

Example 1. REGEXREPLACE function for Google Sheets

When it comes to getting rid of everything before and after certain characters, REGEXREPLACE also helps. Remember, the function requires 3 arguments:

REGEXREPLACE(text, regular_expression, replacement)

And, as I mentioned above when I introduced the function, it's the second one you should use correctly so the function knows what to find and remove.

So how do I remove the addresses and keep only phone numbers in cells?
Delete all before a plus sign.
Here's the formula I will use:

=REGEXREPLACE(A1,".*\n.*(\+.*)","$1")

Remove text before a character.

  • Here's the regular expression I use in this case: ".*\n.*(\+.*)"

    In the first part — .*\n.* — I use backslash+n to tell that my cell has more than one row. So I want the function to remove everything before and after that line break (including it).

    The second part that is in brackets (\+.*) says that I want to keep the plus sign and everything that follows it intact. I take this part in brackets to group it and keep it in mind for later.

    Tip. The backslash is used before the plus to turn it into a character you're looking for. Without it, the plus would be just a part of the expression that stands for some other characters (as an asterisk does, for example).
  • As for the last argument — $1 — it makes the function return that only group from the second argument: the plus sign and everything that follows (\+.*).

In a similar fashion, you can delete all phone numbers yet keep the addresses:

=REGEXREPLACE(A1,"(.*\n).*","$1")

Only this time, you tell the function to group (and return) everything before the line break and clear out the rest:
Google Sheets: remove text after a certain character.

Example 2. RIGHT+LEN+FIND

There are a few more Google Sheets functions that let you remove the text before a certain character. They are RIGHT, LEN and FIND.

Note. These functions will help only if the records to keep are of the same length, like phone numbers in my case. If they're not, just use the REGEXREPLACE instead or, even better, the easier tool described at the end.

Using this trio in a particular order will help me get the same result and remove the entire text before a character — a plus sign:

=RIGHT(A1,(LEN(A1)-(FIND("+",A1)-1)))

Erase everything before the plus sign using three Google Sheets functions together.
Let me explain how this formula works:

  • FIND("+",A1)-1 locates the position number of the plus sign in A1 (24) and subtracts 1 so the total doesn't include the plus itself: 23.
  • LEN(A1)-(FIND("+",A1)-1) checks the total number of characters in A1 (40) and subtracts 23 (counted by FIND) from it: 17.
  • And then RIGHT returns 17 characters from the end (right) of A1.

Unfortunately, this way won't help much to remove the text after the line break in my case (clear phone numbers and keep addresses), because the addresses are of different length.

Well, that's all right. The tool at the end does this job better anyway ;)

Remove the first/last N characters from strings in Google Sheets

Whenever you need to remove a certain number of different characters from the beginning or the end of a cell, REGEXREPLACE and RIGHT/LEFT+LEN will also help.

Note. Since I already introduced these functions above, I will keep this point short and provide some ready-made formulas. Or feel free to hop to the easiest solution described at the very end.

So, how can I erase the codes from these phone numbers? Or, in other words, remove the first 9 characters from cells:
How to get rid of those codes in the phone numbers?

  • Use REGEXREPLACE. Create a regular expression that will find and delete everything up to the 9th character (including that 9th character):

    =REGEXREPLACE(A1,"(.{9})(.*)","$2")

    Remove the first 9 chars from cells using REGEXRELACE.

    Tip. To remove the last N characters, just swap the groups in the regular expression:

    =REGEXREPLACE(A1,"(.*)(.{9})","$1")

  • RIGHT/LEFT+LEN also count the number of characters to delete and return the remaining part from the end or the beginning of a cell respectively:

    =RIGHT(A1,LEN(A1)-9)

    Remove the first 9 chars from cells using RIGHT+LEN.

    Tip. To remove the last 9 characters from cells, replace RIGHT with LEFT:
    =LEFT(A1,LEN(A1)-9)
  • Last but not least is the REPLACE function. You tell it to take the 9 characters starting from the left and replace them with nothing (""):

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

    Remove the first 9 chars from cells using the REPLACE function.

    Note. Since REPLACE requires a starting position to process the text, it won't do if you need to delete N characters from the end of a cell.

Formula-free way to remove specific text in Google Sheets — Power Tools add-on

Functions and all is good whenever you have time to kill. But do you know there's a special tool that embraces all of the aforementioned ways and all you are to do is select the required radio button? :) No formulas, no extra columns — you couldn't wish for a better sidekick ;D

You don't have to take my word for it, just install Power Tools and see it for yourself:

  1. The first group lets you remove multiple substrings or individual characters from any position in all selected cells at a time:
    Remove substrings or characters using Power Tools.
  2. The next one removes not only spaces but also line breaks, HTML entities & tags, and other delimiters and non-printing characters. Just tick off all the needed checkboxes and press Remove:
    Remove whitespaces and delimiters using Power Tools.
  3. And finally, there are settings to remove text in Google Sheets by a certain position, first/last N characters, or before/after chars:
    Remove characters by position using Power Tools.

Another tool from Power Tools will remove time and date units from timestamps. It's called Split Date & Time:
Split Date & Time for Google Sheets to remove time from timestamps.
What's the splitting tool got to do with removing time and date units? Well, to remove time from timestamps, select Date since it's a part you want to keep and also tick off Replace source data, just like on the screenshot above.

The tool will extract the date unit and replace the entire timestamp with it. Or, in other words, this add-on for Google Sheets will remove the time unit from the timestamp:
Google Sheets – remove time from timestamps.
You can have all these and over 30 other time-savers for spreadsheets by installing the add-on from the Google Store. The first 30 days are completely free and fully functional, so you have the time to decide if it's worth any investment.

If you have any questions related to any part of this blog post, I'll see you in the comments section below!

You may also be interested in

43 comments to "Google Sheets: remove the same text or certain characters from multiple cells at once"

  1. Allie says:

    Hi there! So I am trying to create a column where I have a pallet count. I have tried all of the suggested formulas and am still struggling. I have a few examples below. I exported information from a program into excel, but need it for a project I am doing in Google Sheets. I had struggled to create formats and formulas to make this work :(. When I export the information, it appears like below.

    I would like to be able to paste this into a google sheets column, with just the beginning number in front of Pallets, and get rid of everything else. Do you have any suggestions?

    Thank you!

    27Pallets801.58lbs1884.1ft3
    1Pallet37.5lbs43.84ft3

  2. Cynega says:

    Hi!
    Is there a way to combine RIGHT and LEFT in one formula cell?
    I need to do this...
    =LEFT(A1,LEN(A1)-17) and =RIGHT(A1,LEN(A1)-34), all in one cell.

    Is there a chance of doing this?
    I tried combinen them by brackets, but it doesn't work either
    =(RIGHT(A1,LEN(A1)-34)),(LEFT(A1,LEN(A1)-17))

  3. Georgina says:

    Hi Natalia,

    I need to delete years and brackets after text e.g DEPARTED, THE (1961). How would I go about doing this so I remain with just DEPARTED, THE

    Thank you!

  4. Kieran Tummon says:

    Hi Natalia
    I am a teacher and I create roll lists for house exams. I need to delete names from the lists as the students are sitting there exams in a separate centre.
    The software will generate the class list for me but I have to remove names and I have to do this manually.
    Is there a formula in Google sheets that I can use where the name is removed. I can easily deal with the empty cell afterwards.
    My hope is that if I can use a formula to remove the names, I can then use that formula for various subjects.
    Thanks
    Kieran

    • Hi Kieran,

      I'm afraid there's no way to remove the contents of a cell by placing a formula there. Formulas return results to the same cells they are used in, and they can't refer to the same cells they are entered in. In this case, you will need to use Apps Script to avoid manual data processing. You may try to find a solution here – an overview of Google Apps Script with a lot of helpful content and links.

  5. Mario says:

    Cell data contains:
    domainname.comForwards to http: //subdomain.domainname.com

    Is there a way to remove everything in a cell from "Forwards to...." to the end?

    What I want to end up with is the beginning part:
    domainname.com

    Thanks

  6. Jack C. says:

    This was a very good article. Its explanations were clear and concise. Thank you.

    I have a sheet that has phone numbers with a 1 in front of every number. How can I remove it from every number without removing all the 1's in the list? I tried the left, right and len but not getting results.
    17137996969
    17139565876
    12102265350
    12107042187

  7. Leo says:

    Thank you, the guide helped a lot...
    Question : how would I specificaly delete characters present between any parenthesis and parenthesis themselves ?
    like:

    Paris (1D4)
    London (11)
    Berlin (abc)...

    Result : "Paris", "London", "Berlin" etc...

  8. yohan bianchini says:

    Hi, I would like to delete the text in the cells "K7" when I write " yes " in the cells "L7" do you know how I can do that?
    Thanks

  9. Deborah Burton says:

    Is there a way to limit the number of characters that will print out from a column when doing a mail merge. My sheet is to print out spine labels. I have Dewey decimal #, authors last name, and Title. I inputted all data from LibraryThing but I need to limit the Title to maybe the first 20 characters.
    Can you think of any way I can do this for the whole column (934 titles).
    Thanks so much.

  10. Lauren says:

    Hi! I just wanted to know how to remove text from a column so its just the numbers when I copy in bank statements.
    It looks like:
    D
    Money In, £, 20.00
    Money In, £, 50.00
    Money In, £, 15.00
    etc
    I just want to know how to get rid of the" money in", or how to make the sum without an error.

  11. Calvin says:

    Is there a way to mask a list of names due to confidential reasons, which are contained in a column with names? I would like to keep the first name, and mask the second and third words with asterisks, while keeping the first letter of the second and third words.

    eg
    "Adam John Smith" to "Adam J*** S****
    "Charlie Doe" to "Charlie D**"
    etc

    Many thanks in advance !!!

  12. Yusoph Macabalang says:

    +1 1520-222-9195
    +1 1773-443-3769
    +1 1480-547-5498
    +1 1480-205-2468
    +1 1602-339-0394
    +1 1480-226-6228
    +1 1623-428-4605
    +1 1602-921-4482
    +1 1928-830-9057
    +1 1602-482-9678
    +1 1602-330-6397
    +1 1602-394-1963
    +1 1970-317-1135
    +1 1602-371-7951
    +1 1623-313-5432
    +1 1602-551-5827

    Is there a way to remove the number "1" except for those with "+"?

  13. Yorong says:

    vm2-01.17
    vm2-01.17
    vm2-01.17
    vm2-01.17
    vm2-01.17
    vm2-01.17
    busy
    accepted
    vm2-01.17
    vm2-01.17
    vm2-01.17
    vm2-01.17
    accepted
    busy

    I want to remove the ones that contains vm

  14. Forbes says:

    Hi I have a data set like this.
    355
    365
    957
    0563R
    043
    0576R
    754
    523
    0376R
    452
    054
    0965R
    0573R
    678

    I want to remove 0 value only on the digits end with 'R'. Any specific way to do this without doing each manually. Thanks

  15. Yohance says:

    Thank you lots. Is there a way to replace/substitute numbers before or after a number or date, eg p5/12/2021 please?

  16. Nitesh Kumar says:

    I am cleaning up a string which contains *, commas, some other special characters as well as "[9]" in front of name. Every other character was handled except [ ] . While I could introduce an extra substitute function to handle this, is there as way to handle [ ] inside the formula contained in [ ] in one go ?

  17. Rai says:

    Hello! I am using a join formula to combine names from one column with the names from another column with an & in-between. For some of the rows, they do not contain a name in the second column so the formula is creating a name followed by an & with nothing following it. Is there a way to remove the &'s that do not have a name following them while leaving the ones that do alone?

  18. Dyna says:

    I appreciate this guide. Is there a way to remove those numbers before or after a person’s name (e.g., Carol20, 123Jason) please?

Post a comment



Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)