+ Reply to Thread
Results 1 to 7 of 7

Creating a comma separated list from a column of numbers, omitting duplicates, spaces

  1. #1
    Registered User
    Join Date
    10-07-2011
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Creating a comma separated list from a column of numbers, omitting duplicates, spaces

    Hello Excel forum community! I seek your expert advice again.

    What I'm trying to do is take information that is located in a column of numbers, and be automatically forwarded to a single cell with commas between each number, and omitting any duplicates and spaces (empty cells), with them also being in numerical order.

    For example:
    8765
    8765
    9803
    2011
    8765
    0008

    in six columns would be taken to a single cell as:
    0008, 2011, 8765, 9803


    In the sample workbook attached, I have information in sheet two, column A and needs to be sent automatically as a comma'ed list to sheet one, B1

    On sheet two, the space for potential data input is between A2 and A20

    I can include my actual project (with dummy information) if the sample project doesn't explain clearly enough what I need to accomplish.

    I only have limited knowledge of programing with VBA,so a code snippet would be preferred.

    Thank you in advanced!
    Attached Files Attached Files
    Last edited by Higoten; 12-16-2011 at 08:52 PM.

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Creating a comma separated list from a column of numbers, omitting duplicates, sp

    I created an User Defined Function let me know if that's what you're looking for

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-07-2011
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Creating a comma separated list from a column of numbers, omitting duplicates, sp

    Hi jiejenn, thanks for the quick response,

    The function you made puts the column into a list with commas, but its not omitting the blank (empty) cells, duplicates, or putting them into numerical order,

    Like in the sample project, it is outputting:

    ,,,,,,,,,,7783222,783222,783222,9,983921,909231,983921,762831,

    More of what i was hoping for would be something along the lines of an output of:
    9, 762831, 783222, 909231, 983921

    Thanks!

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Creating a comma separated list from a column of numbers, omitting duplicates, sp

    with a few functions! v1 all same length v 2 as entered
    Attached Files Attached Files
    Last edited by martindwilson; 12-16-2011 at 08:30 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    10-07-2011
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Creating a comma separated list from a column of numbers, omitting duplicates, sp

    Thank you Martin!
    does just what i was looking for!
    +rep

  6. #6
    Forum Contributor
    Join Date
    11-04-2011
    Location
    pak
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Creating a comma separated list from a column of numbers, omitting duplicates, sp

    Hello Higoten,
    another option
    Please Login or Register  to view this content.

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Creating a comma separated list from a column of numbers, omitting duplicates, sp

    The attached has the UDF ConcatIf and the formula
    =ConcatIf(Sheet2!A2:A20,"<>",Sheet2!A2:A20,",",TRUE)

    Please Login or Register  to view this content.
    Attached Files Attached Files
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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