I have transcripts of online customer service interactions in Sheets that I would like to anonymize. They are formatted like so:
09:11:37 - Jane Doe : Good morning!
09:12:00 - John Smith : Hello!
The entire sheet has many many different names and hundreds of interactions, so find and replace is still tedious. Is there a way to isolate everything between "-" and ":" and either replace or delete on each line? I found examples of similar things, but could never get the syntax quite right.
Also open to other ideas or tool suggestions!
TIA
You can use regular expression
=regexreplace(A1,"(\-.*: )","")
Just a little idea, I would give.
You can use SEARCH() to find where : and - is and you can extract the sub string from the text.
Example:
A3 has "09:11:37 - Jane Doe : Good morning!"
LEFT(A3, SEARCH(" - ", A3) - 1) would give me 09:11:37 and what basically we are doing is getting Substring from the beginning of the text.
MID(A3, SEARCH(" : ", A3) + 3 , 100000) would give be Good morning!
now finally use CONCATENATE to join these strings as
= CONCATENATE( LEFT(A3, SEARCH(" - ", A3) - 1), " ", MID(A3, SEARCH(" : ", A3) + 3 , 100000))
Now you will get the string as 09:11:37 Good morning!
Hope that works. Play around with the formula cheat sheet.
Reference: https://support.google.com/docs/table/25273?hl=en
Related
I am using this formula in Google Sheets to substitute some string of words.
=ArrayFormula(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Z2:Z36000,"# ", "OF ")," ALUMINUM BAG ", ""),"BOX IN",""),"BOX OF",""),"",""))
The data
DATA Column Expected Results
BOX OF BEER BEER
BOX IN BASEMENT BASEMENT
BOX OF GIFT BOX OF GIFT
I would like to exclude "BOX OF GIFT" with Substitute. Can i do that? OR any other solutions?
You could use in B2:
=REGEXREPLACE(A2,"^(?:(BOX OF GIFT$)|BOX (?:OF|IN) )(.*)","$1$2")
Or:
=IF(A2="BOX OF GIFT",A2;REGEXREPLACE(A2,"\bBOX (?:OF|IN)\b *",""))
I'll see if I can come up with a cleaner option...
I have to make a conditional formating formula with cross-sheet references.
Basically I have many sheets, one with existing words, and another one with words we have to add. I want to highlight in "Feuille 6" the words that are already in "Existant". I tried many formulas, I read the doc, I still can't figure it out.
Quick edit : equiv = match, and ligne = row, it's just google sheet translating words into French..
Here's the formula I think I should use, but it's not working
=EQUIV(A,indirect("Sheet1!A"&LIGNE()))
Here's what the Feuille 6 looks like
Again, there should be highlighted words in Feuille 6, like " Action ", which already exists in the sheet " Existant ".
I tried replacing "Sheet1 "with "Existant" too.
Any tip please?
Thanks !
Try:
Assuming the sheet Existant has values in columns A to Z , and you are highlighting cells in column A
=countif(indirect("Existant!A:Z"), A1)
I'm trying to pull data from another Google Sheet to feed another Google Sheet. I need to pull from a full name field, which will have something like, "Bob Smith" and then I need to have it rewrite into the new Google Sheet as "bsmith".
Basically, "Get first letter of the first string, then concatenate the entire second string, and then make all lowercase."
So far I've gotten =LEFT(A28,1) working to grab the first letter of a string, but then not sure how to grab the second word and then concatenate.
To get the 2nd word you need to FIND() the first space then read from that position + 1 to the end of the string using MID(). & is used for concatenation.
=lower(left(A28,1) & mid(A28, find(" ", A28) + 1, len(A28)))
Try this for a Google sheet specific solution:
=LOWER(REGEXREPLACE(A2,"^(\w).*?(\w+$)","$1$2"))
It uses REGEX, a much more sophisticated engine and easily adaptable to variations than LEFT and/or MID.
Shorter:
=lower(left(A28)&index(split(A28," "),2))
(Assumes only ever two words.)
I am trying to do a calculation of two cells, where one of them contains a number like this: 1 250.
If the number is written like that, and not 1250, then I cannot get the spreadsheet to do any calculations with it. Google suddenly do not treat it as a legit number anymore.
Why not just type 1250 instead of 1 250?
Well, I am getting the cell values from a html import function.
Any good advice on how to get around this?
Try something like this:
=Substitute(A2," ","")
In this formula, A2 is a cell. You are finding any spaces in that cell and then replacing it with a "non-space".
Use the substitute function to transform your number before using it in a formula. For instance, let's say you wanted to multiple F8 by 2, but F8 may contain spaces. You would then do:
=substitute(F8, " ","") * 2
Substitute didn't work form me. But these steps did:
Select one or several columns of data
Press Ctrl + H to get the "Find and Replace" dialog
Make sure "Search using regular expressions" is checked ✅
Enter \s to the "Find" field, and leave "Replace with" empty
Click on the "Replace all" button
Explanation:
\s is a regular expression matching any kind of whitespace character. There may have been some other kind of whitespace in my spreadsheet, not a regular " " (space) character, and that's why regex worked for me, while SUBSTITUTE() didn't.
I've also tried the REGEXREPLACE(A2, "\s", "") function, but it didn't seem to to anything in my case.
I need a formula to extract the last two words in a cell using openoffice. For example a cell contains the words: "enjoy the rest of your day" I would like to extract "your day" using a formula. I know how to extract the last word:
=RIGHT(A1;LEN(A1)-FIND("*";SUBSTITUTE(A1;" ";"*";LEN(A1)-LEN(SUBSTITUTE(A1;" ";"")))))
which results in "day". But i need a formula for the last two words.
SEARCH supports regular expressions, so use
=RIGHT(A1, LEN(A1) - SEARCH("[^ ]+ +[^ ]+$", A1) + 1)
When I use semicolons as below, Calc silently substitutes commas, but the OP reports success entering it this way:
=RIGHT(A1; LEN(A1) - SEARCH("[^ ]+ +[^ ]+$"; A1) + 1)