+ Reply to Thread
Results 1 to 17 of 17

Group rows with same content together.

  1. #1
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Group rows with same content together.

    I have a very large excel sheet and need to group rows with the same content in a specific column.

    Is it possible to create vba code which allows me to group these rows ?

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Group rows with same content together.

    Have you tried the sub totals feature under the Data tab?

    It will help you group similar data from 1 column.

    If you need to match multiple columns, you can create a helper column, concatenate the data from different columns and then use Sub Totals..

    Give it a try!
    Cheers!
    Deep Dave

  3. #3
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    this option is not active (grayed out) in the columns where I want to use it.

    The content of the column where I want to look for duplicates to combine is based on a formula and does not contain numbers.
    It tells me you need headers, but I don't use headers.

    Is there any other way to do this ?

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Group rows with same content together.

    Can you not use temporary headers and then get rid of them once you are done?

  5. #5
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    I have a header already, but the Subtotal feature is grayed out, except when I select a cell in an unsed column.

    The final sheet I have has almost 1 million rows, so I would like to automate as much as possible. are there other ways ?

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Group rows with same content together.

    Can you please attach your sample sheet?
    Last edited by NeedForExcel; 04-13-2015 at 01:00 AM.

  7. #7
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    Here it is.

    if you look on the sheet 'copy' you fine the header 'Source dir' in column O. all duplicate lines should be removed, or better group them together.
    It is used for copying data, so you can imagine that it is useless if there are 2 or more equal lines.

    http://www.filedropper.com/example_1

  8. #8
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Group rows with same content together.

    Hi, the Subtotal feature is greyed out because your data set is formatted as Table.

    Either you do not format your table as a Table and use Sub Totals or we will have to look for an alternate way..

    See the file attached to see how it will look.. Also use the 1,2,3 button at the left top corner to check out the functionality..
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    great,

    This look likes how I need it.

    Although to make it perfect, I need another sub total for the column 'G' which is named as third section.
    Is it possible to have 2 sub totals for different columns in one sheet ?

    by the way, I would like to unformat my original document to enable the subtotal function, how did you do that ?

  10. #10
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Group rows with same content together.

    To un format, use short keys Alt > B > V > Enter..

    You cannot have 2 Sub-Totals I am afraid..

  11. #11
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    This combination doesn't work on my Excel 2013 version.

    |s there a menu option I can go to, for disabling it ?


    If I cannot use 2 Subtotal options there is something else I would like to do, but it might be a little harder:

    all cells with similar content in a specific column should each be moved to a separate worksheet.
    So I get as many worksheets as there are different values in a specific column.

    Is there a way to achieve this ?

  12. #12
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Group rows with same content together.

    Quote Originally Posted by henk400 View Post
    This combination doesn't work on my Excel 2013 version.

    |s there a menu option I can go to, for disabling it ?
    I am sorry, its actually the Right Click Button On the Keyboard and not the Alt key.. You can also right click on the table > table > convert to range

    Quote Originally Posted by henk400 View Post
    If I cannot use 2 Subtotal options there is something else I would like to do, but it might be a little harder:

    all cells with similar content in a specific column should each be moved to a separate worksheet.
    So I get as many worksheets as there are different values in a specific column.

    Is there a way to achieve this ?
    That can be done using Pivot Table too... Is that fine with you?

  13. #13
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    Of course, I am very happy if that does the job, but how do I get it done ?

  14. #14
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Group rows with same content together.

    Quote Originally Posted by henk400 View Post
    Of course, I am very happy if that does the job, but how do I get it done ?
    Hi,

    Please see the file attached.

    Click on the Pivot Table > Click On Analyze Tab > On the Left, click on the little arrow next to the "Options" button > Select Show Report Filter For Pages > Click OK.

    Sheets will be created for each Source_dir and would normally be renamed. However, the Text Strings in the Source_dir field cannot be valid sheet names, hence the sheets wont be named!

    Try it out..

    If it does not help you, we will try using VBA
    Attached Files Attached Files

  15. #15
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Group rows with same content together.

    Why do not you Concatenate and sort....to group similar rows together.....
    Last edited by LokeshKumar; 04-13-2015 at 07:04 AM.
    Lokesh Kumar
    Stay Hungry.. Stay Foolish..
    _________________________________________________________
    Please Click STAR to Add Reputation if my/someone's answer helped!

  16. #16
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    It look likes something I need, but it is not easy for me to check because of the dummy content which doesn't make it very clear.
    I have uploaded a similar file where the content looks more realistic, so I can check if it is correct.

    In this file I have moved the columns source and destination dir to column A and B, these are the most important columns for me.

    In column I the project name is listed, the pivot table should use that column to look at and sort by project name.

    I have added a pivot table to an additional sheet, this looks quite nice, I am using the project name (column Third Section).
    If I collapse the project name I get the source_dir underneath it. I would like to have the destination dir's in the next column (B)

    If I select the field destination dir it will be visible in column A.
    file: example4.2


    example4.2.xlsx
    Attached Files Attached Files
    Last edited by henk400; 04-13-2015 at 08:02 AM.

  17. #17
    Registered User
    Join Date
    03-06-2015
    Location
    Rotterdam, The Netherlands
    MS-Off Ver
    2013
    Posts
    22

    Re: Group rows with same content together.

    I have these rows already sorted, but the issue is that I want to have only one line of the group with similar values. All others should be made hidden or removed.

    I am using this sheet to copy data and it is quite useless to copy twice (or even more times) the same content.

    For several folders I have a couple of hundred lines with the same source folder. this should become just one line.

    Ideal for me would be a combination of the project name and the source_dir.

    In the file 'example4.2.xlsx' the first column has the Source_dir and the column I which says 'Third Section' has the project name.

    If the combination of the values in both columns are the same I only need to have one line. all other lines with the same values should be for example hidden or marked with an x in a new column so I can filter them out.
    Last edited by henk400; 04-16-2015 at 08:24 AM.

+ 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. Auto Group content from Cube via Pivot Table
    By SisterMable in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 03-10-2015, 04:52 AM
  2. [SOLVED] Move the content of specific groups of cells in column C to the first cell in that group
    By aviatecar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-08-2014, 12:57 PM
  3. Replies: 1
    Last Post: 02-10-2014, 10:26 PM
  4. Group based on cell content or color
    By Shaner73 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2012, 04:35 PM
  5. Replies: 0
    Last Post: 07-15-2009, 01:17 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