Excel formula to remove comma, spaces, period and add a text - excel

Context
I have data like this:
Reyes, Ma. Luisa Jun-Oh, Junee Carter, John Jr.
I need to use a combination of excel formulas in one cell to remove commas, periods, spaces and replace with underscore. Also need to add text after the names (to be used as PDF filename).
Expected output
Reyes_MaLuisa_Text123; JunOh_Junee_Text123; Carter_JohnJr_Text 123 (no
period and trailing space removed)
What I've tried
Formula used: =REPLACE(I2,FIND(", ",I2,1),2,"_") & "_Text123" where I
is the name field.
Thanks.

SUBSTITUTE it is easy to use
=SUBSTITUTE( SUBSTITUTE(I2,",","_") ," ","_")

Related

NetSuite custom field - Formula to remove special characters

I have a current saved search formula that groups values from two fields in lowercase, and It also replaces any spaces with hyphen. Currently it also removes two special characters including period and forward slash. I am now trying to modify this formula to also remove 2 additional characters including Apostrophe (‘) and quotation mark (“)
Following is the current formula: TRANSLATE(LOWER(CONCAT({custitem38}||'-', {custitem16})), ' /.', '--')
This worked for me: TRANSLATE(LOWER(CONCAT({custitem38}||'-', {custitem16})), ' "/.', '--')
enter code hereTRANSLATE(LOWER(CONCAT({custitem38}||'-', {custitem16})), ' "/.', '--')
This might work
TRANSLATE(LOWER(CONCAT({custitem38}||'-', {custitem16})),'‘"/"/.', '--')

Keeping leading zeros with find and replace

I'm using Excels find and replace to remove hyphens from long numbers. They are mixed between birth dates and organisation numbers that have been filled with leading zeros to have the same number of characters. There are a LOT of numbers so find and replace seems to be the simplest solution to remove the hyphens.
But when i use find and replace the leading zeros are truncated and I have not found a solution to keep them afterwards.
For example i have:
19551230-1234
01234567-8901
and after find and replace I have
1,95512E+11
12345678901
but want the format as:
195512301234
012345678901
So I want to keep the leading zeros after find and replace. I've tried formatting the cells as text, but it doesn't work as the find and replace automatically truncates the leading zero and keeps the remaining characters, so the zero is completely removed. I am using Excel 2010, but answers for several versions are appreciated.
Just put a single quote in front of your leading number - ex. '01234 It will take the number as-is literally and the quote will not show in the field.
Use the SUBSTITUTE formula instead of Find and Replace like so:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1," ",""),"/",""),")",""),"(",""),"-","")
The result is text.

How in Excel to Remove only 1st comma (exact character, symbol or string)

I have numbers witch when is 1000 then has comma "," before hundreds like 1,234,00
How to remove 1st comma or make 2nd to appear so it would be 1234,00 or in excel as it works as number if has only space then with space or comma?
I have formula so far for getting number
=MID(LEFT($A604;FIND(" on ";$A604)-1);FIND("?";$A604)+1;LEN($A604))*1
And for removing all i put it in substitute to remove commas but that makes number wrong higher like 123400
=SUBSTITUTE(MID(LEFT($A604;FIND(" on ";$A604)-1);FIND("?";$A604)+1;LEN($A604));",";"")*1
The issue is the format #,##0, puts a comma before every third number. You need to treat it as a string
Try this in B2:
=IF(A2<999,A2,CONCATENATE(MID(A2,1,LEN(A2)-3),",",MID(A2,LEN(A2)-2,3)))
Depending on your use it might be best to remove the IF

remove a character from the end of a text string only if it is there in excel

I have a list of file names in excel I need to Match with another list. Some of the file names contain extra characters that need to be removed first though. I have a formula that will remove special characters and spaces from the file names;
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($E8,"_",""),"-",""),".","")," ","")
But some of the file names contain an extra 1 at the end I need to remove, please see example;
2AALNOR120114
DCA CDE 12-01-14
OPASDOCS120114
TWASCE1202141
TWASCE1203141
STCSRA120120141
STCSRA120220141
If anyone could give me a Formula solution that strips out the above special characters and the 1 at the end of the filename that would be great.
Bonus credit if you can also strip out the 20 from the STC files as well to output as STCSRA120114 instead of STCSRA12012014
Edit: For clarification, final result would ideally look like this;
2AALNOR120114
DCACDE120114
OPASDOCS120114
TWASCE120214
TWASCE120314
STCSRA120114
STCSRA120214
Thanks,
Ben
Maybe:
=LEFT(A1,LEN(A1)-IF(RIGHT(A1,1)="1",1,0))
(Replace the first two instances of A1 above with a suitable version of your SUBSTITUTE formula, and the last with E8).
With substitution:
=LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(E8,"_",""),"-",""),".","")," ",""),LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(E8,"_",""),"-",""),".","")," ",""))-IF(RIGHT(E8,1)="1",1,0))
A sightly shorter version of the A1 one:
=LEFT(A1,LEN(A1)-(RIGHT(A1)="1"))

Excel - present word between certain characters

I am trying to split some data up but stuck! I have some data which comes out like the below:
USERNAME Full Name Department
USERNAME First Initial Surname Department
USERNAME Full Name Department
I have tried numerous items such as trim then can pull out words however some peoples full names are 3 words and most of them are 2 words so this kinda breaks it all.
I have also tried substituting the double spaces so it breaks it up like so
##USERNAME#######Full Name######Department###########
##USERNAME###First Initial Surname Department#
##USERNAME###########Full Name#####Department#####
But still unsure how I can pick up the words between the hashes.
Help really appreciated :)
If you have a text file with the raw data, separate the raw data using either of a TAB, a semi-colon, or a comma. Pick something you do not already have in your file. Semi-colon usually works for me.
Then, open it as a CSV (comma-separated values) file in Excel.
It will try to parse the file automatically. If it doesn't succeed, it will ask you what character you want to use as a separator.
You mentioned double spaces seperating your data, that's your ticket in.
Let's say you've got "USERNAME David Brossard DEPT" in Cell A2.
In B2, let's FIND the first double space:
=FIND(" ",A2)
In C2, let's FIND the second double space:
=FIND(" ",A2,B2+1)
In D2, we'll grab everything in between:
=MID(A2,B2+2,C2-(B2+2))
There you go!
Alternatively, you can write it all in one formula, in B2:
=MID(A2,FIND(" ",A2)+2,FIND(" ",A2,FIND(" ",A2)+1)-(FIND(" ",A2)+2))

Resources