+ Reply to Thread
Results 1 to 5 of 5

Add characters between...

  1. #1
    Registered User
    Join Date
    08-26-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2003
    Posts
    21

    Add characters between...

    I have a string of names that run together without spaces or commas between each name.

    "Danny TrejoJean Claude van DammeVincent SchiavelliGabrielle FitzpatrickDavid 'Shark' FralickPat Morita" for example.

    Is there a way to add a comma and space when an upper case letter is immediately followed by a lower case letter?
    Last edited by Johnf42; 09-14-2009 at 11:55 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add characters between...

    I don't know of a simple way without adding a special function into your sheet. Here's a User-Defined Function (UDF) that will do it for you.

    Please Login or Register  to view this content.
    ==========
    How to install the User Defined Function:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The function is installed and ready to use.
    =========

    If the string were in A1, then put this formula in an adjacent cell:
    =NAMESPLIT(A1, ", ")

    The first parameter is the cell
    The second parameter is the text string you've chose to split the names.
    Last edited by JBeaucaire; 09-14-2009 at 08:03 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-26-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Add characters between...

    Thank you. I'll try this out and let you know how it works.

  4. #4
    Registered User
    Join Date
    08-26-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Add characters between...

    Perfect! Thanks so much for including the instructions.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add characters between...

    My pleasure, and you're welcome. I wish I always remembered...

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].


    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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