+ Reply to Thread
Results 1 to 5 of 5

Sort by one column and then another?

  1. #1
    Registered User
    Join Date
    03-20-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    10

    Question Sort by one column and then another?

    Hi guys,

    I have a list of 'account numbers' with their respective 'next due dates'.
    I need to sort this list to be in order of the earliest next due date first. However some account numbers have more than one due date. Ideally I need them in date order but group the account numbers together even if that account number has a due date much further away than the nearest.

    Any ideas how to sort an excel file in this way?

    If that doesnt make sense ive included below what it would should essentially look like. Sorted by due date but grouped within account number:

    Account Number Next Due Date
    1234567 01/12/2020
    1234567 04/04/2021
    1239898 25/12/2020
    1239898 07/07/2021
    7245896 03/02/2021
    3215648 05/05/2021

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,023

    Re: Sort by one column and then another?

    Select both columns. Then use Data/Sort as shown in the image below.
    Attached Images Attached Images
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    03-20-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    10

    Re: Sort by one column and then another?

    I've tried that but its putting the account number in order first regardless of when the next due date is which in a lot of cases is in late 2021 when i have many next due in December 2020.
    Switching it the other way (Sort by due date first, then Customer Number) does not work either as it still splits out the customer account numbers.

  4. #4
    Registered User
    Join Date
    03-20-2019
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    10

    Re: Sort by one column and then another?

    Quote Originally Posted by Glenn Kennedy View Post
    Select both columns. Then use Data/Sort as shown in the image below.
    I've tried that but its putting the account number in order first regardless of when the next due date is which in a lot of cases is in late 2021 when i have many next due in December 2020.
    Switching it the other way (Sort by due date first, then Customer Number) does not work either as it still splits out the customer account numbers.

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,548

    Re: Sort by one column and then another?

    I assume that the original data set is in date order.
    I have added a column which groups accounts based on the rank of the earliest due date for each account number and is populated as follows:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I then set up a pivot table which uses the new column (First Due Dates) as the first field in the Rows area.
    Note that the First Due Dates on the pivot table may be hidden for aesthetic purposes.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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: 8
    Last Post: 05-12-2019, 07:35 AM
  2. Replies: 12
    Last Post: 09-08-2018, 10:34 PM
  3. Replies: 1
    Last Post: 03-29-2018, 07:58 AM
  4. Replies: 5
    Last Post: 05-09-2017, 08:48 AM
  5. Replies: 1
    Last Post: 03-04-2015, 02:57 PM
  6. [SOLVED] I have a sort macro. How to add script to preselect rows to sort based on column value?
    By Jasonhouse in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-09-2014, 02:25 AM
  7. Replies: 2
    Last Post: 01-15-2014, 09:31 AM

Tags for this Thread

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