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!

SOLVED

Isolating first and last words in string

rwelman003
5 - Atom

Hi there,

 

I am trying to isolate the first and last word in a string. I have data of names and some names include middle names or nicknames The names can vary up to 5 words.... I first tried to do text to columns but then I don't know how to get the surname of the shorter names under the right column. I then tried to use the RegEx function to parse the first and last names but have been unsuccessful in writing a formula. Please can someone assist?

 

Thanks!

wdavis
Alteryx
Alteryx

Hi @rwelman003 

 

If you use the Formula tool you can use the 'GetWord' and 'CountWords' formulas to get this for you.

 

For the first name it would be Getword([Field], 1) then for the last name it would be Getword([Field]. (Countwords([Field])-1)

 

Let me know if that works for you

 

Kind regards

Will

rwelman003
5 - Atom

Brilliant, this has worked perfectly! Thanks so much!

karam
8 - Asteroid

Hi @rwelman003 

 

Please see attached example of how this can be achieved using RegEx.

 

first_last.PNG

 

 

 

Regards,

Karam

shuman_p
7 - Meteor

... however, methinks your " Getword([Field]. (Countwords([Field])-1)" has a small typo with the "." (fullstop), which should be a "," (comma)?

Data_User88
7 - Meteor

...

Labels