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

Remove all characters after initial whitespace.

mattcoleman
8 - Asteroid

I'm trying to remove all characters that happen after initial whitespace. Should be a pretty simple split, but I can't figure it out. Example below:

 

PM AWI -> PM

123 GAM -> 123

1nas89 aee aer -> 1nas89

 

Thanks!

Matt

4 REPLIES 4
Thableaus
17 - Castor
17 - Castor

Hi @mattcoleman 

 

What about a Text to Columns Tool?

 

Solution.PNG

 

Cheers,

KP_DML
8 - Asteroid

You could use the formula tool to grab the string up to where the space occurs.

 

Left([InputField], FindString([InputField],' '))

Thableaus
17 - Castor
17 - Castor

@mattcoleman 

 

You can also try regex.

 

REGEX_Replace([Field1], "(.+?)\s.*", "$1")

 

or REGEX_Replace([Field1], "(\S+)\s.*", "$1")

 

Cheers,

mattcoleman
8 - Asteroid

All of these methods actually work, so thanks! I prefer the LEFT formula tool or REGEX over the Text to Columns tool due to the creation of an additional column.

Labels