Free Trial

Alteryx Designer Desktop Discussions

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

Splitting Names

AvinashBhawsar
8 - Asteroid

Hi I have been trying to split the name by using text to column and regex tool however, did not get the result.

 

here is the scenario-

 

i have a Name column which includes First, Middle and Last name.

 

requirement:- 

1) i want to split the name into 2 columns First & Last name.

2) First name column will be the combination of  First and Middle name.

3) Last Name column will only have Last name.

 

Problem :-:-some records in the Name Column do not have middle names, only first and last name. so, in this case first name should go into the first name column and last name into the last name column.

 

Sample Data:-

 

Names
A PRAVEEN KUMAR
RISHAB MOHAN
PALASH GAIKWAD
RAMESH ATRE
PREM MANJUNATH SHETTY
VINOD SHRINIVAS SHETTY

 

Output:-

 

First NameLast Name
A PRAVEENKUMAR
RISHABMOHAN
PALASHGAIKWAD
RAMESHATRE
PREM MANJUNATHSHETTY
VINOD SHRINIVASSHETTY

 

Thanks,

4 REPLIES 4
JosephSerpis
17 - Castor
17 - Castor

Hi @AvinashBhawsar I mocked up some regex which may tackle your challenge. The expression i'm using (.*)\s(.*)$ is searching for everything between a space which \s however the dollar sign is end of line. 

 

Screenshot 2024-10-22 201014.png

AvinashBhawsar
8 - Asteroid

@JosephSerpis Thank you!

AvinashBhawsar
8 - Asteroid

Hi Joseph,

 

i recently check those split names however, I found issues with some of the names which are not getting split in to first and last name column and also few are showing as blank in the first name column even though they have first name in the Name column. also there should b a logic to apply where we do not have last name we have to put . (dot) in the last name as it should not blank. can you please help me. @JosephSerpis 

 

Thanks,

Avinash Bhawsar

 

Last NameFirst NameNAME
  SWEETY
  SUMEET
  NISHANT
  MADHUSUDHAN
  ABHISHEK
  ADITYAJEET
  PALLAVI
  DIWAKAR
  BHAWNA
  KABILAN
  MANISHA
  JAYASHREE
  S.MOHANRANGA
  ROHIT
  VARUN
  NARENDER
  R.K.MADHUVANTHI
  LAKHVINDER
  NEETU
  MOAZZAM
  RUPAL
  VENKATESH
  V.S.KRUTHIKHA
  Himani.
ChrisTX
16 - Nebula
16 - Nebula

For this requirement

 there should b a logic to apply where we do not have last name we have to put . (dot) in the last name as it should not blank.

 

Add a Formula tool before the RegEx tool.  Update the value for the Name column

IF FindString(Trim([Name]), " ") = -1

THEN [Name] + " ."
ELSE [Name]
ENDIF

 

You may need a Select tool before the Formula tool, to increase the field size.

 

Screenshot 2024-11-11 073654.png

 

Chris

Labels
Top Solution Authors