Get first string first character and last string first character seperated with spaces
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @ssphv
This uses one of favourite formulas in Alteryx...GetWord....
Left(GetWord([Field1], 0),1) + " " + Left(GetWord([Field1], CountWords([Field1])-1),1)
Neil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
That works as expected! Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
.
