Learn formulas and formula-free ways for Google Sheets 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. Continue reading
by Natalia Sharashova, updated on
Learn formulas and formula-free ways for Google Sheets 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. Continue reading
Comments page 2. Total comments: 97
Is it possible to use this function to take a cell with existing information (A2) and add the information in another cell (combine A2 and B2) to create a new list, then use it again to take that new list (C2) and remove the information in another cell (D2) to generate a new list?
I tried to add a picture to show it better, but it won't let me. This is a link to a Google Sheet that tries to show it visually: https://docs.google.com/spreadsheets/d/1hlLuvSuBQSV04dxTkyWU9SO1W13sfnEdRVlfCzkONNk/edit#gid=0
Thank you!!!
Hello Julia,
You can merge names from A2 & B2 together using one of the ways from this blog post. The last method is the easiest.
As for removing, you can remove substrings (different names) quickly using our Remove tool as well.
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
Hi Allie,
Try extracting everything before Palett using the way described in this blog post: Extract data before a certain text
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))
Hi Cynega,
If you need to concatenate both strings returned by LEFT and RIGHT, you can try using one of the methods from this blog post.
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!
Hi Georgina,
Assuming the data is in A2, try this formula:
=REGEXREPLACE(A2,"(.*)\((.*)","$1")
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.
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
Hello Mario,
Assuming your cell with that record is A2, use this formula:
=REGEXREPLACE(A2,"(.*)Forwards to (.*)","$1")
Look through this part of the article to understand how it works.
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
Hello Jack,
Please see this part of the article: How to remove the first N characters
If it still doesn't work, please specify the exact formula you're using.
hey i have data like
$1.5 --in same cell
0.01 -- same cell
$2
0.1
how to split into two column , above method not working
Hey,
Please see this tutorial on how to split cells in Google Sheets into columns.
Is there a way to remove " " ?
For example getting JASON from "JASON"
Thanks !
Hello Jason,
Sure, use this method. The formula will look like this:
=SUBSTITUTE(A2,"""","")
Formula to remove the last period of a sentence in a cell?
Hello Dark,
Please see this section: Remove the first/last N characters from strings in spreadsheets
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...
Hello Leo,
Try this formula:
=REGEXREPLACE(A1,"(.*)\((.*)\)","$1")
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
Hi Yohan,
Either build the IF formula in any additional cell (to remain empty when 'yes' appears in column L7, otherwise to return the contents of K7) or use Google Apps Script to edit one cell with a record from another.
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.
Hello Deborah,
If you'd like to keep all data in cells intact but print out only a limited number of chars, you can simply resize columns before printing the sheet.
If you want to remove chars from cells completely, our Power Tools will help you remove everything after the 20th (or any other) character.
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.
Hi Lauren,
Based on how your data looks, I'd advise you to look through the last 3 parts of this blog post. You can use any of the ways described there.
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 !!!
Hello Calvin,
I'm afraid masks cannot consider the number of characters. So for your case, you can try a formula like this (assuming the data is in A1):
=ArrayFormula(JOIN(" ", ARRAY_CONSTRAIN(SPLIT(A1, " "), 1, 1), REGEXREPLACE(SPLIT(REGEXREPLACE(A1, "^.*?\s+?", ""), " "), "[a-z]", "*")))
Excellent and thanks a lot!
+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 "+"?
Hello Yusoph,
Yes, if you need to remove those "1" that go right after "+1", you can either try the formulas suggested in this part of the blog post or use the add-on instead, it's much easier and faster.
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
Hi,
do you want to remove the entire rows or only clear the values from cells?
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
Hi there,
Well, you can wrap REGEXREPLACE in ArrayFormula and it will calculate all rows at once. For example, for these 14 rows this formula will do:
=ArrayFormula(IFERROR(REGEXREPLACE(A1:A14,"0(.*)R","$1R"),A1:A14))
Thank you lots. Is there a way to replace/substitute numbers before or after a number or date, eg p5/12/2021 please?
Hello Yohance,
Please give me an example of how your record may look like before and should look after.
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 ?
Hello Nitesh,
Please provide the exact formula you're using so I could suggest a way to improve it.
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?
Hello Rai,
Try incorporating the IF function for your task. You'll be able to check if the 2nd column contains a name and return a corresponding value.
I appreciate this guide. Is there a way to remove those numbers before or after a person’s name (e.g., Carol20, 123Jason) please?
Hello Dyna,
You can try a formula like this:
=REGEXREPLACE(A2,"[^[:alpha:]]", "")