+ Reply to Thread
Results 1 to 6 of 6

taking the extra Commas out of a Concatenate formula

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    taking the extra Commas out of a Concatenate formula

    In C4:C13 I have a list of from 0 to 10 names. Each cell will either have a name or be blank. I want to concatenate the results, adding a comma and space to each entry. My formula is:

    =C4&", "&C5&", "&C6&", "&C7&", "&C8&", "&C9&", "&C10&", "&C11&", "&C12&", "&C13

    My issues is that if five of the cells are blank I get 5 commas at the end of my list. How do I stop the commas from being generated when they're unneeded?

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: taking the extra Commas out of a Concatenate formula

    =substitute(c4&", "&c5&", "&c6&", "&c7&", "&c8&", "&c9&", "&c10&", "&c11&", "&c12&", "&c13,", ","",counta(c4:c13))
    it is wrong, working formula is lower
    Last edited by tim201110; 02-22-2017 at 12:21 PM.

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,572

    Re: taking the extra Commas out of a Concatenate formula

    This proposed solution employs a helper column, which could be hidden for aesthetic purposes and/or moved if needed. The formula that populates the helper column (pasted into D4 and copied down to D13) is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The end result is then placed in another cell by =D13
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: taking the extra Commas out of a Concatenate formula

    Tim,
    I think I see the idea, but the application failed. Before, my formula displayed 7 extra commas (using only 3 names), after applying your solution the formula displayed 6 commas.

    JeteMC,
    That is a workable solution, but I'd rather do it without a helper column if there is a way.
    Last edited by jomili; 02-22-2017 at 12:08 PM.

  5. #5
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: taking the extra Commas out of a Concatenate formula

    =substitute(c4&", "&c5&", "&c6&", "&c7&", "&c8&", "&c9&", "&c10&", "&c11&", "&c12&", "&c13,REPT(", ",10-counta(c4:c13)),"")
    sorry, misunderstanding of the function

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: taking the extra Commas out of a Concatenate formula

    And we have a winner! That REPT was the trick! Thanks Tim.

+ 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. CONCATENATE function and extra commas
    By araistrick in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-02-2015, 09:03 AM
  2. [SOLVED] Export to CSV writes extra 130 lines of commas
    By dubcap01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2015, 05:09 AM
  3. [SOLVED] Remote extra commas from Column
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-21-2014, 08:54 AM
  4. Convert to CSV , extra commas displaying
    By yashu in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2013, 08:49 PM
  5. Create CSV without extra Commas
    By naveenkharb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2010, 10:56 AM
  6. Concatenate formula not taking decimal places/currency sign
    By woodsonline in forum Excel General
    Replies: 4
    Last Post: 05-27-2009, 03:34 AM
  7. Extra trailing commas in exported CSV
    By lucidr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-25-2006, 08:40 AM

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