I am trying to do a text to columns for the below data with "space" as my delimiter. However, some of the data has a dash (-) in between and that is also getting separated out when i run my text to column. I don't want these values to be separated out. See below for the text to column i ran:
PARVANEH SOLYMANI
SUSAN ROGERS
SAPNA SINGH
SUSAN SCAGLIONE
SAMANTHA VIRDIN-SMETANA
Solved! Go to Solution.
Are there any scenarios where you would want a "-" character to separate to a new column?
If you ran this text-to-columns without the dash in your "-\s" delimiter setting, that last name should remain together after the split.
If all scenarios should be separated into two pieces (first name and last name), you can use 2 as the number of columns in the text to columns tool. You can use the same delimiter that you had previously (-\s) if you want the column to be split by EITHER the first instance of a space or dash. The default settings will leave all additional instances as is.
If you only want records to be split by a space, use "\s" as the delimiter.
See attached for an example.
Hi @mustufa2019 , if you're wanting to split the columns only when there is both a dash AND a space following, then you can use the RegEx tool. A rough example of how to do this is provided below. Disclaimer: I'm still getting the hang of RegEx!
Thank you @echuong1 , @kelsey_kincaid , and @NickSm ! Are three worked perfectly!