Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

Get first string first character and last string first character seperated with spaces

ssphv
Météore

I have a column with first, last and middle names together separated with spaces as below,

 

 

Stephen A

Jahn John F

Antony G

Mary G

Nick J N 

 

 

I would like to get the first letter of first name and last letter with initial as below. With few names having middle names I just want to get first and last initials. How can I get that,

 

S A

J F

A G

M G

N N 

4 RÉPONSES 4
LordNeilLord
Aurore

Hey @ssphv 

 

This uses one of favourite formulas in Alteryx...GetWord....

 

Left(GetWord([Field1], 0),1) + " " + Left(GetWord([Field1], CountWords([Field1])-1),1)

 

 

Neil

JohnJPS
Aurore

Use the RegEx tool with the expression (.).*\s(.).* and set it to Parse.

 

This will grab the first character (.) then any number of characters .* until a string where we'll grab the first character (.), which will be followed by any number of characters .* (remaining in said string).

 

The parentheses mean those characters are "marked" and thus returned as fields in the tool output.

 

Hope that helps!

John

 

ssphv
Météore

That works as expected! Thank you!

DeanLewis
Astéroïde

Étiquettes