+ Reply to Thread
Results 1 to 4 of 4

Convert string in format "Smith, John" to "John Smith"

  1. #1
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Convert string in format "Smith, John" to "John Smith"

    I pull in usernames in the form of "Smith, John" into a string.

    I would like to convert this string to be "John Smith" instead.

    (Not just for the name "John Smith" obviously but for any name)

    What's an easy way to do this?

    Thanks!

  2. #2
    Registered User
    Join Date
    08-31-2011
    Location
    Stamford, CT
    MS-Off Ver
    Excel 2013
    Posts
    30

    Re: Convert string in format "Smith, John" to "John Smith"

    You can select the column with the usernames and use Text to Columns (under the data tab or ALT+A+E). Select Comma Delimited. Then use a formula such as =TRIM(B1)&" "&A1 to remove the space from the first name, flip the order of the names, and concatenate them back together with a space.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Convert string in format "Smith, John" to "John Smith"

    Assuming Smith, John is in A1, then you can use this formula in B1:

    =TRIM(RIGHT(A1,LEN(A1)-FIND(",",A1))&" "&LEFT(A1,FIND(",",A1)-1))

    then copy down as required.

    Hope this helps.

    Pete

  4. #4
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: Convert string in format "Smith, John" to "John Smith"

    This is on a userform actually, so I was hoping for a VBA solution. I suppose I could involve a worksheet in the operation and pull the value from there but wasn't sure if there was an easier way.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 12
    Last Post: 06-01-2019, 07:04 PM
  2. Convert string in format "Smith, John" to "John Smith"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2015, 12:00 PM
  3. Replies: 10
    Last Post: 07-22-2015, 01:23 PM
  4. Replies: 2
    Last Post: 10-31-2013, 01:27 PM
  5. Replies: 1
    Last Post: 07-16-2012, 08:04 PM
  6. Replies: 1
    Last Post: 06-19-2012, 08:52 PM
  7. Replace text "Smith, Joe" into "Joe Smith" for a single cell
    By flyingmachine in forum Excel General
    Replies: 6
    Last Post: 04-07-2005, 02:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1