Alteryx Designer Desktop Discussions

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

Text to Columns

Pablo_Borba
5 - Atom
 

I hope someone can assist with this question, I am using text to columns to separate State and Country, however, some countries don't have state separated by comma on the column.

 

 Location
South Africa
South Africa
South Africa
South Africa
South Africa
AZ, United States
IL, United States
United Kingdom
United Kingdom

 

This is the result I am getting, but I really wanted the United States to be on the same column as other countries.

 

South Africa[Null]
South Africa[Null]
South Africa[Null]
South Africa[Null]
South Africa[Null]
AZUnited States
ILUnited States
United Kingdom[Null]
United Kingdom[Null]
5 REPLIES 5
alexnajm
17 - Castor
17 - Castor

Doable with a Formula!

Raj
16 - Nebula

@Pablo_Borba 
please find the workflow attached
mark done if solved.

ScottLewis
10 - Fireball

Somebody with better RegEx than me could probably give you a way to use RegEx Parse to do this in one but here's a way to do it in two.

 

Using a formula to add a leading comma on the elements that don't have one sets the data up for text to columns to return countries in column 2.

 

Formula is: if contains([ Location], ",") then [ Location] else ","+[ Location] endif

LeadingComma.PNG

terry10
12 - Quasar

@pab

 

Non regex solution attached 

Pablo_Borba
5 - Atom

Thanks all, all suggestions worked perfectly

Labels