+ Reply to Thread
Results 1 to 9 of 9

Ascending order in group of 5

  1. #1
    Registered User
    Join Date
    09-26-2020
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Ascending order in group of 5

    Hello, This is my first message in this forum.

    I am having a list something like :-

    1
    2
    2
    3
    5
    5
    5
    5
    5
    6
    7
    8
    8
    8
    8
    8
    8
    8
    8
    8
    9
    10
    10
    10
    10
    10
    10
    10
    11
    12
    12
    12

    I want to sort it in ascending order but in group of 5 Like:

    1
    2
    3
    4
    5

    2
    3
    4
    5
    6

    2
    5
    7
    8
    9

    2
    8
    10
    11
    12

    8
    10
    12
    10
    12

    10
    12
    12
    12
    12

    Please guide me, i am unable to think for a solution, Regards

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Ascending order in group of 5

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Ascending order in group of 5

    If you do post a workbook make sure your example is valid.
    With the numbers you posted the ranked values contains numbers that are not in the original set. e.g. No 4 in original, 3 appears twice in rank but once in data set.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    09-26-2020
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Re: Ascending order in group of 5

    Thanks Andy for your reply, my workbook is big so just for explaining my problem I created a small example.

    "3 appears twice in rank but once in dataset"----as i said i created the example manually so that was a mistake from my side, i am just trying to express my requirement

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Ascending order in group of 5

    Create a small, sample workbook. Not hard to do.

  6. #6
    Registered User
    Join Date
    09-26-2020
    Location
    India
    MS-Off Ver
    2013
    Posts
    3

    Re: Ascending order in group of 5

    Thanks for your advise. I have made a sample workbook & attached it, "sort.xlxs". Please go through it.

    Regards.
    Attached Files Attached Files

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Ascending order in group of 5

    Here is a vba solution using the UNIQUE and SORT formula. Not sure if you have those if you are really using 2013
    It uses a column L and N to manipulate the data.

    Please Login or Register  to view this content.
    I think we need more information about the rules for populating the buckets.
    For example if there were seven 2s how would they get distributed? You would get one instance in each bucket but where would the seventh occurance end up?

  8. #8
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Ascending order in group of 5

    With formula solution
    D1=b3
    D2:

    Please Login or Register  to view this content.
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).

    Drag down
    Attached Files Attached Files
    Quang PT

  9. #9
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Ascending order in group of 5

    I'm not sure that this formula based solution has much to recommend it over bebo021999's solution, other than possibly my step by step approach may be easier to understand, but having spent the time I'll post it anyway

    The apparent algorithm that maps the input to the expected output:
    Repeat until all numbers allocated
    Move to the top of the list
    Repeat until 5 numbers have been selected or the end of the list is reached
    Pick a number excluding any previously picked number and skipping repeated numbers
    End
    End
    .
    There needs to be at least as many helper columns as there are returns to the top of the list in the above algorithm. For this data set 10 columns are needed. In D3 copied across and down to O32:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    From these helper cells the required output can be generated by reading down the first column then the second column then the third and so on.

    Col-Q takes each helper column in turn and consolidates them into a single column. In Q3 copied down at least as far as the number of inputs (30) times the number of helper columns (10) plus 2 = row 302:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Finally col-S removes the blanks from col-Q and reproduces the expected output. In S3 copied down to S32:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See the attached workbook.
    Attached Files Attached Files
    Last edited by GeoffW283; 09-29-2020 at 12:09 PM.
    Geoff

    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select ?Solved? from the Thread Tools menu

+ 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. [SOLVED] Date Ascending Order and other data alphabetic order
    By rajeshn_in in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-04-2019, 08:12 AM
  2. Ascending Order
    By isaackoh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-26-2014, 10:59 AM
  3. Ascending Order
    By isaackoh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2014, 06:49 AM
  4. [SOLVED] Generate "ascending order no" for columns of data that are not in order
    By abreichenbach in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-20-2013, 02:22 AM
  5. Re: Bar Graph in ascending order
    By newbie4 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 10-23-2012, 05:49 AM
  6. ascending order
    By cbian in forum Excel General
    Replies: 2
    Last Post: 06-05-2008, 07:26 AM
  7. Ascending order and IF
    By kookinuttz in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-07-2007, 08:27 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