+ Reply to Thread
Results 1 to 8 of 8

Group set of values from a column to a comma separated row with a worksheet function

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    22

    Group set of values from a column to a comma separated row with a worksheet function

    I have a few hundred rows with only values in column A.
    I want to get groups of 10 values from column A and make this a comma separated string on every multiple of 10 row in column B (row 1,10,21 etc).
    I simply want to drag and copy the same formula in each cell of column B and not have to manually insert a formula on every multiple of 10.

    I DON'T want to use a Macro, just a worksheet function.
    So the end result of calculated column B values should be:

    A B
    3 3,3,1,4,5,6,6,7,2,2
    3
    1
    4
    5
    6
    6
    7
    2
    2
    5 5,7,8,9,4,5,6,7,9,3
    7
    8
    9
    4
    5
    6
    7
    9
    3
    4 4,5,6,7,8
    5
    6
    7
    8

  2. #2
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Group set of values from a column to a comma separated row with a worksheet function

    Paste this formula into cell B1 with ctrl+shift+enter since it's an array formula. Drag it down as needed:



    =IF(MOD(ROW(),10)=1,LEFT(csv,MAX(ISNUMBER(MID(csv,ROW($1:$100),1)*1)*ROW($1:$100))),"")

    where csv = A1&","&A2&","&A3&","&A4&","&A5&","&A6&","&A7&","&A8&","&A9&","&A10



    It assumes that rows 1, 11, 21, etc are the rows that need the formula results to show. It'll give you the appropriate number of commas to go with it too.
    Last edited by clabulis; 07-03-2014 at 03:40 PM.

  3. #3
    Registered User
    Join Date
    07-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    22

    Re: Group set of values from a column to a comma separated row with a worksheet function

    Sorry for my rookiness, but I'm not sure what you mean by:

    where csv = A1&","&A2&","&A3&","&A4&","&A5&","&A6&","&A7&","&A8&","&A9&","&A10, where and how exactly do I define that?

    ps I forgot to mention, but I use Excel 2013 so in my case the commas in your formula would be semicolons

  4. #4
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Group set of values from a column to a comma separated row with a worksheet function

    No problem! The "csv" thing was only to try and make the formula look a little nicer. Here's the actual formula to use if you're looking for comma-separated values (Remember to use Ctrl+shift+enter):

    =IF(MOD(ROW(),10)=1,LEFT(A1&","&A2&","&A3&","&A4&","&A5&","&A6&","&A7&","&A8&","&A9&","&A10,MAX(ISNUMBER(MID(A1&","&A2&","&A3&","&A4&","&A5&","&A6&","&A7&","&A8&","&A9&","&A10,ROW($1:$100),1)*1)*ROW($1:$100))),"")

    If you're looking for semicolon-separated values, then use this:

    =IF(MOD(ROW(),10)=1,LEFT(A1&";"&A2&";"&A3&";"&A4&";"&A5&";"&A6&";"&A7&";"&A8&";"&A9&";"&A10,MAX(ISNUMBER(MID(A1&";"&A2&";"&A3&";"&A4&";"&A5&";"&A6&";"&A7&";"&A8&";"&A9&";"&A10,ROW($1:$100),1)*1)*ROW($1:$100))),"")

  5. #5
    Registered User
    Join Date
    07-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    22

    Re: Group set of values from a column to a comma separated row with a worksheet function

    I actually meant that I use Excel 2013 where the , in formulas has been replaced by ;. I still want the result of the calculation to be comma separated
    I tried your new formula, but it gives me unexpected results, such as fewer than 10 cells in the result column.
    Also when I remove rows at the end of the sheet, some calculated results in rows higher than the rows I remove seem to disappear
    See my sheet here: www.in2medical.net/tmp.xlsx

  6. #6
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Group set of values from a column to a comma separated row with a worksheet function

    I didn't realize your raw data includes letters as well. This is the formula to use for text and numbers (paste it into cell B1 and use ctrl+shift+enter):

    =IF(MOD(ROW(),10)=1,LEFT(A1&","&A2&","&A3&","&A4&","&A5&","&A6&","&A7&","&A8&","&A9&","&A10,MAX((IFERROR(CODE(MID(A1&","&A2&","&A3&","&A4&","&A5&","&A6&","&A7&","&A8&","&A9&","&A10,ROW($1:$100),1)),)>45)*ROW($1:$100))),"")

  7. #7
    Registered User
    Join Date
    07-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    22

    Re: Group set of values from a column to a comma separated row with a worksheet function

    Thanks! I've tried that too, but something is still amiss. I've uploaded a new version with some real data, but it seems your latest function does not take all data from all fields or the entire cell value. What can it be?
    Thanks again!

  8. #8
    Forum Contributor
    Join Date
    05-04-2014
    Location
    New Jersey, United States
    MS-Off Ver
    Excel 2010, 2013
    Posts
    120

    Re: Group set of values from a column to a comma separated row with a worksheet function

    Your real data was much longer in length than the sample data. The attached file should be what you're looking for now. Let me know how it is.
    Attached Files Attached Files
    Last edited by clabulis; 07-04-2014 at 05:30 PM.

+ 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: 05-29-2014, 12:27 PM
  2. Comma Separated Cell Values to Column of Unique Cell Values
    By Nuggetross in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-02-2014, 07:24 PM
  3. Excel 2007 : One column to txt comma separated values
    By Runnit4 in forum Excel General
    Replies: 1
    Last Post: 02-15-2011, 05:44 PM
  4. Comma separated values
    By shrikantk in forum Excel General
    Replies: 3
    Last Post: 05-18-2009, 09:52 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