+ Reply to Thread
Results 1 to 21 of 21

How to sort this list?

  1. #1
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    How to sort this list?

    Hi all,

    i have some sorting issue here,

    Below is the simple data i have with Three columns
    Need to sort 3rd column from Highest to lowest, However the pair sets should not get disturbed in the first two columns

    i have given expected output.

    please help



    Below Data

    Amt D/c Num
    125 D 58
    125 C 56
    40 D 43
    40 C 44
    56 D 65
    56 C 64


    Expected Output

    Amt D/c Num
    56 D 65
    56 C 64
    125 D 58
    125 C 56
    40 D 43
    40 C 44

    Thank you

    If I have helped you in someway, use the * icon below to give reputation feedback, it is appreciated.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to sort this list?

    But if you do sort on the 3rd column you do get the results you say you expect

    Apart from the last two results you show which I presume is a typo since you show the 43 number before the 44 number, i.e they are not sorted highest to lowest.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to sort this list?

    i didnt give best example earlier, consider below example of input and given expected Output too

    conditions :
    Last column should get sorted with highest to lowest
    However the pairs of amt should , stay as paired. ( to keep them paired, last column sort can be adjusted that is fine)
    Refer ouput for understanding

    HTML Code: 

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to sort this list?

    Hi,

    The best you can do without a macro would be to have two sorts conditions in the same sort. The first usiing the first column and the second using the third column.

    Your current requirement isn't possible since there is no order to the first column

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: How to sort this list?

    post deleted.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to sort this list?

    Please try

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to sort this list?

    Hi Jindon,

    Your solution is giving out put as below, you are very close. Good part is firs column pairs are staying as paired, wherever they move.
    only issue is the 3.26 pairs should move up considering the num is 64 order as highest.
    and the 12 pairs should also move up considering the num is 53


    HTML Code: 

    Hi Bo, Ry,

    result of your code is giving output as below,
    You have nicely arranged the 3rd column Num, only thing is pairs should stick together in first column.


    HTML Code: 

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    Try replace Sort_Array procedure with
    Please Login or Register  to view this content.
    Last edited by jindon; 01-21-2021 at 07:30 AM.

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: How to sort this list?

    Maybe try

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to sort this list?

    Hi Jindon,

    I tried with your current code, below is the data.
    it doesnt seem to be giving expected result.


    if you run through with below data, you can see....

    HTML Code: 

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    This is the result after my code
    HTML Code: 
    If this is not how you want, I don't think I understand your sorting logic.
    my code is based on you post #3.
    HTML Code: 
    That is showing sort descending by the group of same amt then sort the group from the biggest max.

  13. #13
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to sort this list?

    Hi Jindon,

    Thanks for your quick response.

    correction is that the amt 31 and num with 64 should come at top right! as per highest to lowest in the third column
    but yeah it should go as pairs

    HTML Code: 

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    Is the "pair" mean that rows have same amt with C & D?
    What if the unique amt has only one of them? I mean not paired.

  15. #15
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to sort this list?

    You are right, it will be always same amt with C and D.

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    Still not clear though...
    Please Login or Register  to view this content.

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    If the "pair" is already made in order and sort 2 rows vs other 2 rows then simply.
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to sort this list?

    Quote Originally Posted by jindon View Post
    Still not clear though...
    Please Login or Register  to view this content.
    i am getting debug error on the below line.................


    Please Login or Register  to view this content.

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    If you upload the workbook that gives you the error, it will help.

  20. #20
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: How to sort this list?

    Quote Originally Posted by jindon View Post
    If you upload the workbook that gives you the error, it will help.
    Oh one intresting fact is, when i run with close to 15000 rows of data i am getting error.

    But with less data like 20 rows, no issues works perfectly !

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: How to sort this list?

    Can not think of anything other than unpaired amt.

+ 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. Data Validation List - Formula to Sort and Return Unique Values in List
    By beewketu in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-14-2015, 04:18 PM
  2. Replies: 2
    Last Post: 03-16-2014, 10:04 AM
  3. [SOLVED] sort list of players by team from player list on separate sheet
    By Biff in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  4. Replies: 2
    Last Post: 09-06-2005, 06:05 AM
  5. Excel sort by Fill Color by custom list sort
    By Dash4Cash in forum Excel General
    Replies: 2
    Last Post: 07-29-2005, 06:05 PM
  6. sort list of players by team from player list on separate sheet
    By Robert in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-18-2005, 09:05 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