Flip First and Last Names in a Column
- 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 in the format of Last Name First Name, eg Smith John. I want it to change to John Smith. Help please!
Solved! Go to Solution.
- Labels:
- Developer
- Developer Tools
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is how you can do it.
Formula:
REGEX_Replace([Field1], "(.+)\s(.+)", "\2 \1")
Workflow:
Hope this helps : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Though not as clean as the Regex, here's my approach that allows for variations of Firstname and possible middlename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Worked, thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Happy to help : ) @veronikababiciute
Cheers and have a nice day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If I want include comma after reversing the string using regex_replace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Meenssankar
The formula would be add comma between 2 and 1
REGEX_Replace([Field1], "(.+)\s(.+)", "$2 ,$1")
Hope this helps : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have never taken the time to learn regex so I just stick with string manipulation to get what I want. I just rebuilt the name by finding the space and taking what is to the right, then adding a space and then taking what is the left. Cheers!
