Alteryx Designer Desktop Discussions

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

Removing suffixes from the name

Idyllic_Data_Geek
8 - Asteroid

I have a requirement to remove the suffix from the name field. For example the values in the field can contain suffixes such as JR, SR, II, III, IV

current value                                 New Value
HENRY ANDERSON IV                HENRY ANDERSON
MACK STOVER III                        MACK STOVER
JOHN JOSEPH LAWLER III         JOHN JOSEPH LAWLER
JEFFREY D KIRKLAND JR         JEFFREY D KIRKLAND

 

The suffix will always be in the end trailing a space. What calc can I leverage to accomplish this? Thanks for your help in advance.

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @Idyllic_Data_Geek 

 

Here is how you can do it.

Workflow:

atcodedog05_0-1645036796047.png

 

Hope this helps : )

 

Qiu
20 - Arcturus
20 - Arcturus

@Idyllic_Data_Geek 
I think @atcodedog05 provided a good one! 😁

amruthas2
8 - Asteroid

@Idyllic_Data_Geek 

You could directly use a formula for the expected output

 

Left([Names],FindString(
REGEX_Replace([Names], "(.*) (.*)", '$1*$2')
,"*"))

amruthas2_1-1645075177097.png

 

 

Idyllic_Data_Geek
8 - Asteroid

@atcodedog05 the small issue with find and replace approach is that it is replacing 'I' anywhere in the string. Where I only want to remove it when it is (space)I,

(space)II,

(space)III,

(space)IV,

(space)JR,

(space)SR

Labels