Alteryx Designer Discussions

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

General Discussions has some can't miss conversations going on right now! From conversations about automation to sharing your favorite Alteryx memes, there's something for everyone. Make it part of your community routine!


Extract certain text in string with formula tool

8 - Asteroid

Hi Community!


Looking to extract certain text out of a string value with the formula tool, I'm thinking RegEx, to create two fields


Current State: 


USA  10 041 South Central


Desired State: 

New Field 1 = 10

New Field 2 = 041 South Central 


Any help would be great. 


Thanks in advance!



12 - Quasar



Below the RegEx



Attached the workflow,



14 - Magnetar
14 - Magnetar

Hi @dlopez 


As well as Messi07's solution, you could also use Text-to-Columns with a space (or \s) as the delimiter and Number of columns = 3.

8 - Asteroid

@messi007  & @PhilipMannering 


Thanks for the tips, would it be possible to do this with a formula in the formula tool? 



12 - Quasar

 I'm curious why the Formula tool? It can be done with Regex, substring, substring with find. Lot's of options. To me, though, the Text To Columns is the simplest and most straightforward way given the example data you provided. And would be the simplest to document, maintain, and understand.

8 - Asteroid



Yah completely agree, not denying all those tools can do it, they certainly can. I typically don't like to add more tools to my flow than necessary, I try to keep it as lean/simple as possible, I already have a formula tool in my flow which is why I'm looking for a solution in that tool specifically; and I just utilized a substring() function to do this. 



14 - Magnetar
14 - Magnetar



Here's a formula tool way of doing it attached.




19 - Altair
19 - Altair

@dlopez ,


I'm piggy-backing on @PhilipMannering :


Expression #1: [FIELD 1]



Expression #2: [FIELD 2]

Substring([field],length(GetWord([Field], 0)) + length([Field 1]) + 2)







Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
8 - Asteroid

@PhilipMannering & @MarqueeCrew 


Thanks for the solutions, always enjoy learning new ways of doing things. Below you'll see my solution I came to....


Current Field = USA  10 041 South Central - all records have "USA" before the bits I need


Calc Field 1 = Trim([Current Field], "USA") - produces "10 041 South Central"


Calc Field 2 = Left([Calc Field 1], 3) - produces "10"


Calc Field 3 = Substring([Calc Field 1],4) - produces "041 South Central"


I also have a SELECT tool in my flow, so I just drop calc field 1 there and leave calc field 2 & 3. This allows me to not have to add any new tools, already have a SELECT in my flow to rename fields, and keep the flow slim and trim. 


Again thanks for your feedback on this, the GETWORD() func is a new one to me that I'll have to play with.