+ Reply to Thread
Results 1 to 8 of 8

Sorting groups of rows by a cell in that group

  1. #1
    Registered User
    Join Date
    10-07-2010
    Location
    Newbury England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Sorting groups of rows by a cell in that group

    Hello,
    I am looking for a way of doing something which is beyond my ability and I hope you can help please. I will explain the overall task and where I have managed to get to.

    I first want to group rows of data by one field within that row (I've got that far). Here is where I fall over so to speak....
    I then want to sort those groups by one of the fields in that group.
    To put it into context, I have rows of data which have a customer identification number and also a date field. There will be rows with the same customer number but different dates. I would like to group the rows by the customer number, but then sort the groups into chronological order of when that customer first appears in the spreadsheet.

    I have included an example, column A is the customer identifier and column B is the date (there is also time in that field but I have found that the =MIN() function still finds the earliest date and time).
    I'm sorry there is a lot of data but this way I can definately say that there are duplicate customers with different dates.
    So to summarise, I would like the rows grouped by column A, and then those groups to be sorted by the earliest date that is in that group.

    I hope that makes sense.

    Many thanks in advance.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-18-2010
    Location
    Kalamazoo, MI
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Sorting groups of rows by a cell in that group

    Sort using column A, then add a level and put column B. Then use Excel's Subtotal ability.All of these options can be found in the "Data" section of the ribbon.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,227

    Re: Sorting groups of rows by a cell in that group

    You can also do a single sort by Date and then a second sort by the other field. This will do the same thing as levels of sort.

  4. #4
    Registered User
    Join Date
    10-07-2010
    Location
    Newbury England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sorting groups of rows by a cell in that group

    Hi cmyers & Marvin,

    Thank you for you replies, both suggestions were sucessful for the sorting part.
    cmyers - Thank you for suggesting the subtotal feature, I managed to group based on column A and then add a subtotal to column B using the MIN function to give the earliest date. I then managed to sort the groups by collapsing them and sorting the subtotals.

    Thanks again, problem solved.

  5. #5
    Forum Contributor Charlie_Howell's Avatar
    Join Date
    09-27-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Sorting groups of rows by a cell in that group

    Here is yet another way if you need it
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-07-2010
    Location
    Newbury England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sorting groups of rows by a cell in that group

    Hi Charlie,

    Thanks, I really like that. Would you be able to explain the method so that I can replicate within different spreadsheets please. Also, if isn't too much trouble, possibly explain how it could be modified to select a date?

    Many thanks again.

  7. #7
    Forum Contributor Charlie_Howell's Avatar
    Join Date
    09-27-2010
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    218

    Re: Sorting groups of rows by a cell in that group

    Take this sheet apart and use what you can and if I can help in the future just let me know.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-07-2010
    Location
    Newbury England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Sorting groups of rows by a cell in that group

    Hi Charlie,
    Thanks for the new sheet. I have been busy recently and not had much of a chance to explore it as yet but it seems to make sense.
    Thank you again, you have been a great help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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