+ Reply to Thread
Results 1 to 14 of 14

Reversing Strings Based On Specific Characters.

  1. #1
    Mike
    Guest

    Reversing String

    This doesn't work

  2. #2
    Miguel
    Guest
    And you must change some commas like the following:
    =RIGHT(A2;LEN(A2)-FIND(",";A2)-1) & " " & LEFT(A2;FIND(",";A2)-1)

  3. #3
    Forum Contributor
    Join Date
    12-07-2004
    Posts
    596

    Reversing Strings Based On Specific Characters.

    Problem:

    Converting the full names in column A, formatted \"LastName, FirstName\" into names formatted \"FirstName LastName\".

    Solution:

    Use the RIGHT, LEFT, LEN and FIND text category functions, as follows:
    =RIGHT(A2,LEN(A2)-FIND(\"\",\"\",A2)-1)&\"\" \"\"&LEFT(A2,FIND(\"\",\"\",A2)-1)

    Example:

    Full Name_________Result
    Seinfeld, Jerry___Jerry Seinfeld
    Bush, George______George Bush
    Jordan, Michael___Michael Jordan
    Bowie, David______David Bowie

  4. #4
    Registered User
    Join Date
    12-13-2005
    Location
    Yorkshire, UK
    Posts
    1
    I just removed the double quotes within the FIND function and it worked fine - like so =RIGHT(A2,LEN(A2)-FIND(",",A2)-1)&" "&LEFT(A2,FIND(",",A2)-1)

  5. #5
    Registered User
    Join Date
    10-02-2003
    Posts
    80
    How do I seperate the one string to 2 columns
    Bush, George to George (column a) Bush (column b)
    vikkam

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Data > Text to Columns, then make sure both space and comma are checked. To reverse the columns you can cut and paste.

  7. #7
    Registered User
    Join Date
    10-02-2003
    Posts
    80

    Question

    I am still confused.
    can you please elaborate by giving example

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    A formula approach......

    with "Bush, George" in A1 use this formula in B1

    =TRIM(REPLACE(A1,1,FIND(",",A1&","),""))

    and in C1

    =LEFT(A1,FIND(",",A1&",")-1)

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    In B1
    =RIGHT(A1,FIND(",",A1)+1)

    and

    in C1
    =LEFT(A1,FIND(",",A1)-1)

    Then paste special values in A1 and B1

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  10. #10
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Ok, say the names are in cells A1:A10. Highlight these cells, then from the menu select Data, then Text to Columns. This will bring up the Convert Text to Columns Wizard.

    Select Delimited, then click Next.

    Make sure both "Space" and "Comma" check boxes are checked, then click Finish.

    What this will do is put the last names in cells A1:A10 and first names in cells B1:B10. If you want them in reverse order, you can simply cut and paste the cells to where you would like them.

  11. #11
    Registered User
    Join Date
    10-02-2003
    Posts
    80

    Wink

    thanks

    vikkam

  12. #12
    Registered User
    Join Date
    01-18-2007
    Location
    San Diego, CA
    Posts
    2

    What if there is a middle initial?

    How can the formula be adjusted if the name read:


    Smith, Brian A.


    TIA, Laura

  13. #13
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Quote Originally Posted by lradon
    How can the formula be adjusted if the name read:


    Smith, Brian A.


    TIA, Laura
    Assuming the name is in A1,

    B1 (first name):
    Please Login or Register  to view this content.
    C1 (middle initial):
    Please Login or Register  to view this content.
    D1 (last name):
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    01-18-2007
    Location
    San Diego, CA
    Posts
    2

    Thanks Jason

    I will try it!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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