+ Reply to Thread
Results 1 to 11 of 11

Multiple values in a cell

  1. #1
    Forum Contributor
    Join Date
    02-07-2011
    Location
    Bhutan
    MS-Off Ver
    Excel 2007
    Posts
    244

    Multiple values in a cell

    Hi friends,
    I was wondering if somebody could help me out with a formula or a VBA code to collate a data in a cell.
    In Column A I have names and in Column B i have multiple values. What I am trying to do is collate all the values in a cell separated by a comma.
    I am attaching a sample file for your reference, it contains a before and after tab.
    Thanks friends.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! * Code to insert in the worsheet module class :

    Please Login or Register  to view this content.
    Last edited by Marc L; 11-29-2013 at 08:49 AM. Reason: optimization …

  3. #3
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Multiple values in a cell

    Here's an alternative..

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    02-07-2011
    Location
    Bhutan
    MS-Off Ver
    Excel 2007
    Posts
    244

    Re: Multiple values in a cell

    Thanks a ton, the code is working perfectly but when there are only one value against a name the code stops working. I was wondering if it is possible like if there is only one value then only one value will appear in Column C.
    Thanks friends.
    Attached Files Attached Files
    Last edited by fatalcore; 11-29-2013 at 11:32 PM.

  5. #5
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Multiple values in a cell

    Hi..

    Just a small change/addition needed.. (shown in red)..

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,560

    Re: Multiple values in a cell

    try
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    02-07-2011
    Location
    Bhutan
    MS-Off Ver
    Excel 2007
    Posts
    244

    Re: Multiple values in a cell

    Waooo ! Works like a charm !
    Thanks a ton !

  8. #8
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Multiple values in a cell

    Hi..

    As per your PM.. I have fixed/integrated my code to work in your real data.

    I also added Jindons code.. you will see that Jindons is quite a bit faster than mine (autofilter is fast but no where near as fast as the method he used)..

    btw.. your column where the results are dumped needs to be formated as text so the comma delimiting doesn't get messed up..
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Alternative for real data to collate only for more than one row :

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-16-2013
    Location
    karachi
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: Alternative for real data to collate only for more than one row :

    Dear Marc L,
    Can you please explain the below lines.
    Set Rs = Re.End(xlUp) //
    Rs(, 3).Value = Join(Application.Transpose(Range(Rs(, 2), Re(0, 2))), ", ") // Transpose(Range(Rs(, 2), Re(0, 2)))

    Thanks in advance

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Multiple values in a cell


    Application.Transpose is the worksheet function, returns a vertical range of cells as a horizontal range, or vice versa.

    Fot other statement, select it and press F1 key, the best help to know its purpose …

    Regards.

+ 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. Replies: 1
    Last Post: 10-01-2013, 02:41 AM
  2. Replies: 5
    Last Post: 08-04-2013, 09:49 AM
  3. Sum values from multiple cells - multiple lookup values in single cell
    By taxdept in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-21-2012, 04:12 PM
  4. [SOLVED] Macro to loop through cell values in a column and format multiple cell values
    By Roop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2012, 05:39 PM
  5. Replies: 2
    Last Post: 02-20-2012, 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