Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Text to columns space and dash

mustufa2019
8 - Asteroid

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

 

 

Alteryx 1.PNG

 

4 REPLIES 4
NickSm
Alteryx
Alteryx

@mustufa2019 

 

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.

echuong1
Alteryx Alumni (Retired)

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.

 

echuong1_1-1578340207921.png

kelsey_kincaid
12 - Quasar

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!

 

kayers_0-1578340613020.png

mustufa2019
8 - Asteroid

Thank you @echuong1 , @kelsey_kincaid , and @NickSm ! Are three worked perfectly! 

Labels