+ Reply to Thread
Results 1 to 19 of 19

Numerical Sorting

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    North Lincolnshire, England
    MS-Off Ver
    Excel 2003 sp3
    Posts
    6

    Numerical Sorting

    Hello,
    I'm new to spreadsheets, so please forgive me for asking you to solve possibly an easy problem. (not for me)
    All I want to do is to add several groups of numbers to create a group total and then sort with
    the highest at the top and show the original row along side the total.
    Have a look at my uploaded xls to best explain what I'm talking about.
    If I change any of the data under members score cards the column under Total will change
    and also the sorted column will change. What I can't do is make the entry column follow the
    sorted column. (I have sorted the entry column manually to show how I want it to look).
    Can anyone please advise or fix it for me.
    Regards
    RichardG
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Numerical Sorting

    The basic formula is:

    =INDEX($U$2:U19,MATCH(X2,$V$2:$V$19,0))

    As you'll see, it's not quite perfect if you have duplicates. I'll have to look for that.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    11-08-2011
    Location
    North Lincolnshire, England
    MS-Off Ver
    Excel 2003 sp3
    Posts
    6

    Re: Numerical Sorting

    Well! that was quick, thanks.
    I'll give it a go.

    Regards
    RichardG

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Numerical Sorting

    hello
    Welcome to the forum.

    Just give you for a start. Manual Sorting.

    when sorting click the column to be sorted and make sure that the expand selection radio button is "selected".

    if you want to include the "Members Score Cards" delete column "T"
    how?
    click the column header "the letter T" then right click choose delete

    and another one do not use "=lage" better copy first the "total" then paste it in the "Sorted column" then apply sorting.

    This will give you some hints on using sort.

    But ofcourse the formula given by TMshucks is much more efficient than using manual sorting (much more advanced).

    Regards.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Registered User
    Join Date
    11-08-2011
    Location
    North Lincolnshire, England
    MS-Off Ver
    Excel 2003 sp3
    Posts
    6

    Re: Numerical Sorting

    Hello VLady,
    Thanks for the tips, I'm ok with manually sorting.
    TMShucks, suggestion almost works and as he stated has problems with
    duplicates, this is very close to what I want, if we can get over that problem I will
    be happy

    Regards
    RichardG

  6. #6
    Forum Contributor
    Join Date
    08-26-2009
    Location
    Iceland
    MS-Off Ver
    Excel 365, Windows 10
    Posts
    110

    Re: Numerical Sorting

    Try this,

    Column A to S and U, V in sheet 1
    Column W to X in sheet 2

    When you change values in sheet 1, your sheet 2 wiill change too.
    In sheet 2 you use auto filter column W to X and sort the column you want.

    Excel is based on rows (same line). If you sort Column A, Cell A2 will be A4. Then B2 will be B4 also.
    If you put your result in another sheet (or below/above table in same sheet) you will cut this connection.

    When I am building excel file, I use quite often sheet 1 as data sheet and sheet 2 for result.

    Good luck.

  7. #7
    Registered User
    Join Date
    11-08-2011
    Location
    North Lincolnshire, England
    MS-Off Ver
    Excel 2003 sp3
    Posts
    6

    Re: Numerical Sorting

    Thanks Reykjavik,
    The closest I have come to what I want is by using TMShucks suggestion.
    but doesn't work with duplicates.
    So still stuck, any more ideas, Please!

    Regards
    RichardG

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Numerical Sorting

    Here's how I would do it. Ranking works if you add a methodology to introduce a tie-breaking number into the rank calculation. In this method, I've added the "row number" as a decimal, so any ties will still have different actual Sum Codes. Then we rank normally.

    Then the same INDEX/MATCH approach works to create the RANK sheet which puts the entire "cards" table into the ranked order.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  9. #9
    Registered User
    Join Date
    11-08-2011
    Location
    North Lincolnshire, England
    MS-Off Ver
    Excel 2003 sp3
    Posts
    6

    Re: Numerical Sorting

    Hi Jerry,
    Thanks for taking the time.
    I like your method. And this will probably do what I require.
    Would it be possible to rank those with equal scores to show as equal.

    Regards
    Richard

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Numerical Sorting

    Ranking yes. But not for the "recreate the whole table in ranked order". For that, the ranks need to be unique so you know what order the table is to be assembled.

  11. #11
    Registered User
    Join Date
    11-08-2011
    Location
    North Lincolnshire, England
    MS-Off Ver
    Excel 2003 sp3
    Posts
    6

    Re: Numerical Sorting

    Thanks Jerry,
    I think you've given me sufficient info to experiment.
    Certainly have learnt a lot about excel since fooling about with this
    little project.

    Regards
    Richard

  12. #12
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Numerical Sorting

    unique rank the sum to use in the index match,then rank again as normal ranking ,then use the unique rank to pull back the ordinary rank
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  13. #13
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Numerical Sorting

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  14. #14
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Numerical Sorting

    Quote Originally Posted by TMShucks View Post
    =INDEX($U$2:U19,MATCH(X2,$V$2:$V$19,0))

    As you'll see, it's not quite perfect if you have duplicates.
    To cope with duplicates try this formula in W2

    =INDEX(U$2:U$19,SMALL(IF(V$2:V$19=X2,ROW(V$2:V$19)-ROW(V$2)+1),COUNTIF(X$2:X2,X2)))

    confirmed with CTRL+SHIFT+ENTER and copied down
    Audere est facere

  15. #15
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Numerical Sorting

    @DDL (not DO): Thank you ... I knew there was a way to do it, I just couldn't work it out and I couldn't find a working example (though I'm sure I've got one somewhere!)

    Thanks again, TMS

    For anyone who's interested, the attached workbook shows all the methods suggested.
    Attached Files Attached Files
    Last edited by TMS; 11-11-2011 at 09:26 AM. Reason: Mental aberration

  16. #16
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Numerical Sorting

    Quote Originally Posted by TMShucks View Post
    @DO....
    Never heard of him........

  17. #17
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,384

    Re: Numerical Sorting

    @DDL: what was I thinking? Apologies, TMS

    And just realised I have the wrong person credited in the example
    Last edited by TMS; 11-11-2011 at 09:28 AM.

  18. #18
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Numerical Sorting

    Late as usual!!

    Try this workbook, it uses a helper column (hidden with a grouping button) to produce "Tie-breakers".
    The method can be extended by adding more decimal levels e.g. =A1+(B1/100)+(C1/10000) etc.
    Attached Files Attached Files
    Last edited by Marcol; 11-12-2011 at 06:34 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  19. #19
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Numerical Sorting

    Or perhaps copy range U2:V19 and paste it as values to range W2.

    Then sorted range W2:X19 selecting Key1:=Range("X2"), Order1:=xlDescending, Key2:=Range("W2"), Order2:=xlAscending

    Alf

+ 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