+ Reply to Thread
Results 1 to 6 of 6

Is there a way to group rows so that they stay together when sorted/filtered?

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    seattle
    MS-Off Ver
    Excel 2007
    Posts
    22

    Is there a way to group rows so that they stay together when sorted/filtered?

    GroupingRowsTogether.xlsx

    I am trying to find a way to group rows based on a similar criteria (ID in the small sample attached), and then filter by another field. If the filter criteria is met, I want to have ALL the rows that match that particular ID displayed.

    For example, in the sample file, let's say I want to return all the rows with a Date 2 less/earlier than 2/28/2015. Wonderland, Alice has a row that meets this criteria. I also want to see any and all rows that have her ID in the ID column, even if the Date2 for that row isn't within that range.

    Will I need to write a macro to do that?

    Should first filter, keep track of the IDs, and then look for any rows that have those IDs?

    Thanks.
    Last edited by Brandon2013; 12-07-2015 at 01:54 PM. Reason: made a mistake on the date

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,794

    Re: Is there a way to group rows so that they stay together when sorted/filtered?

    All the Date2 dates in your example are greater than 2/1/2015 (I assume you mean 1st Feb 2015), so that isn't a good criteria to choose.

    Pete

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    seattle
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Is there a way to group rows so that they stay together when sorted/filtered?

    Edited original post. Thanks for pointing out my date error.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,794

    Re: Is there a way to group rows so that they stay together when sorted/filtered?

    You can put this formula in E3:

    =IF(D3="","",IF(COUNTIFS(A$3:A$30,A3,D$3:D$30,"<"&DATE(2015,2,28)),"yes","no"))

    and copy down to E30. Then you can apply a filter to column E, selecting yes from the drop-down.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    01-28-2014
    Location
    seattle
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Is there a way to group rows so that they stay together when sorted/filtered?

    Thank you. That does exactly what I wanted.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,794

    Re: Is there a way to group rows so that they stay together when sorted/filtered?

    Glad to hear it.

    As you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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: 3
    Last Post: 02-06-2015, 05:47 AM
  2. Stop equations updating dynamically when table is sorted/filtered
    By drDanRyan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-07-2014, 08:10 AM
  3. Cololrs on individual bar charts won stay fixed when sorted
    By accelerator in forum Excel General
    Replies: 0
    Last Post: 01-20-2012, 04:08 AM
  4. Sorted and Filtered cell totals
    By Quagga in forum Excel General
    Replies: 1
    Last Post: 07-18-2011, 04:25 AM
  5. Replies: 2
    Last Post: 05-10-2011, 04:41 AM
  6. Replies: 4
    Last Post: 08-17-2005, 04:05 PM
  7. filtered sorted packing list report from data table
    By Lori H in forum Excel General
    Replies: 1
    Last Post: 07-22-2005, 09:05 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