Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

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

ssphv
7 - Meteor

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 REPLIES 4
LordNeilLord
15 - Aurora

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
15 - Aurora

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
7 - Meteor

That works as expected! Thank you!

DeanLewis
8 - Asteroid

Labels