+ Reply to Thread
Results 1 to 6 of 6

Convert space between first and last name to comma

  1. #1
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Convert space between first and last name to comma

    All,

    Any easy way to convert Smith John to Smith,John? No need to lose the space.

    I tried a find and replace but some people have middle names like Smith John C so it ends up replacing it to look like Smith,John,C

    Thanks!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Convert space between first and last name to comma

    Try

    =SUBSTITUE(A1," ",",",1)

  3. #3
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2013
    Posts
    200

    Re: Convert space between first and last name to comma

    That was crazy easy. Def a function i didnt know. Thanks!

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Convert space between first and last name to comma

    Try this out:

    =SUBSTITUTE(TRIM(A1)," ",",")

    If there are any additional spaces, present accidetally, this will prevent the extra ones from beoming commas.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Convert space between first and last name to comma

    In another cell

    =SUBSTITUTE(A1, " ",", ",1)
    copied down.
    Then copy new column and paste special Values back into the original column (Col A for example)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Convert space between first and last name to comma

    You're welcome..

    Keep in mind, it will be wrong for people with 2 word last names like Van Pelt or whatever..

    And there really isn't anything you can do about it
    Considering that Either the first or last name could have 2 words.
    There is no way for excel to know if it's the first or last name (or both) that is 2 words.

+ 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. [SOLVED] Replace space to comma
    By rarementality in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2014, 09:15 AM
  2. [SOLVED] QUICK HELP WITH removing space and comma
    By mecutemecute in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-17-2013, 09:35 AM
  3. [SOLVED] Adding space after a comma of a name using macro
    By jericho_sy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2013, 11:14 AM
  4. Macro inserting comma & space
    By katmison in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-29-2012, 10:24 PM
  5. [SOLVED] Removing a space after a comma
    By DebbieK9 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 04-01-2005, 06:06 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