Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Parse Last Name using Regex

spro
5 - Atom

I'm trying to split one column containing Last name and suffix into two different columns. The issue I'm experiencing is multiple Last names separated by a space.


I want Last names in one column and suffix if any in a second column. I used regex to create a column with just the suffix but I don't know how to remove it from the Last name column.

 

This is an example of my data with multiple Last names in a single column:
Last Name
Gonzalas Soto Rojo Perez JR.
Morales Garcia Jr.
Navarro Valencia
Platt
Rhodes II
Sosa Sparks Phd
Stewart

 

Desired output, 2 columns:

LastnameSuffix
Gonzalas Soto Rojo PerezJR.
Morales GarciaJr
Navarro Valencia 
Platt 
RhodesII
Sosa SparksPhd
Stewart 


Any suggestions are much appreciated!

-shirley

3 REPLIES 3
fmvizcaino
17 - Castor
17 - Castor

Hi @spro ,

 

I'm attaching a regex based solution. My idea was to identify any 3 letter word and separate as a suffix

fmvizcaino_0-1586911774770.png

 

Best,

Fernando Vizcaino

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

Did you know that you can:

 

countwords([name])

it could be used to find the last word.  

 

if countwords([name]) > 2

getword(countwords([name]-1)

else null

endif

 

you can build a list of suffixes in a text input tool and use a find replace tool to Check for matches (case insensitive). 

just some thoughts to help. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
spro
5 - Atom

Awesomeness, this works!

Thank you so much.

-shirley

Labels