We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Reorganize Text Input into separate fields

Gilld
8 - Asteroid

I would like to reorganize the attached data (image) into two fields; City and Postcode - what would be the best way to do this? 

12 REPLIES 12
LordNeilLord
15 - Aurora

Hi @Gilld,

 

I'd go for something like this logic, if there are no numbers in the field (and I'm not aware of any UK city with numbers in the name) then it's a city else its a postcode. Then applying this logic to a multirow formula you can get something like this:

 

Postcodes.PNGExample attached

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

LordNeilLord
15 - Aurora

@Gilld

 

Did the solution work?

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

Gilld
8 - Asteroid

Thanks for this @LordNeilLord !! Sorry I can't seem to split the field into 'contains numbers' and 'doesn't contain numbers'?

Gilld
8 - Asteroid

Thanks for this!! Sorry I can't seem to split the field into 'contains numbers' and 'doesn't contain numbers'?

LordNeilLord
15 - Aurora

If you use the RegEx_CountMatches([Field1], "\d") = 0 (like I showed in my example) ...which is basically saying, count the numbers in the field

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

Gilld
8 - Asteroid

Hi @LordNeilLord, I am getting the attached - not quite sure how this helps?

LordNeilLord
15 - Aurora

Hey @Gilld

 

Your Multirow formula isn't quite right...try this:

 

If RegEx_CountMatches([City],"\d")=0 Then [City] Else [Row-1:NewField]
Endif

And you need to set your newfield to be a string type.

 

You can use the multirow formula i provided in the original attachement

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

Gilld
8 - Asteroid

Thanks @LordNeilLord!

 

The field has split (attached) - but the postcodes and cities are now muddled up? 

 

LordNeilLord
15 - Aurora

@Gilld

That is super weird!

 

Can you send me the flat file you are using and I can have a proper look?

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

Labels
Top Solution Authors