+ Reply to Thread
Results 1 to 9 of 9

Need to rank a columns contents based on another column

  1. #1
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2016
    Posts
    313

    Need to rank a columns contents based on another column

    I have a column of numbers which shows order of finish in a tournament.

    Example for the following columns.
    Col A Col B Col C Col D Col E Col F
    Player Name MP Game W/L Ratio Points W/L Ratio Place TieBreak Ranking
    Raquel Welch 20 1.67 1.11 1 0
    Bill Wallace 19 1.32 1.04 2 0
    Janet Leigh 18 1.29 1.06 3 1
    Jay Boateng 18 1.04 0.97 3 3
    Toni Tenille 18 1.05 1 3 2
    Barry Scott 17 0.96 1 6 0
    Clark Gable 16 1 1.02 7 1
    Alex Trebek 16 0.91 1.01 7 2
    Sean Hernandez 16 1.05 1.01 7 2
    Shawn Sapp 14 0.84 0.96 10 1
    Jean-Marie Kanai 14 0.8 0.94 10 2
    Mark Masters 12 0.5 0.88 12 0


    I would like to have column F do a ranking of column D by descending order but only for those players who are tied (same value in column E) - I'd like a constant value of zero for players not tied in column E. So cell F2 and F3 would have value 0. Since E4 thru E6 are tied with value of 3 then column F formula would rank column D in descending order as follows - F4 thru F6 would have value of 1, 3, 2. If column D has same value on a tiebreaker set then they should have the same value in column E - example in rows 8 thru 10.

    Is there a way to accomplish this via a formula or by a vba macro? I need to rank rows 2 thru 13 only.

    Please let me know if this is do-able?

    PS - the example above became skewed after I posted it - please refer to the attachment instead.

    Thanks for any help you can give.
    Attached Files Attached Files
    Last edited by pongmeister; 01-23-2016 at 08:01 PM. Reason: Sorry the example became skewed after I posted - please refer to the attachment instead.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need to rank a columns contents based on another column

    Try this Macro

    Please Login or Register  to view this content.


    This can be reduced to:

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-23-2016 at 08:52 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Need to rank a columns contents based on another column

    How about using this formula, instead of fiddling about with a helper column?
    E2=RANK($B2,$B$2:$B$13)+COUNTIF($B$2:B2,B2)-1
    copied down
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2016
    Posts
    313

    Re: Need to rank a columns contents based on another column

    Thanks for the quick response. I got an error when I tried macro1:

    Run-time error '438':
    Object doesn't support this property or method.

    Then I tried Macro2 and the result was almost perfect. Since there is a 3 way tie for seventh place in cells E8, E9 and E10 AND cells D9 and D10 both have a value of 1.01 is there a way to have cells F9 and F10 with the same value : In this case they would both have a value of "2" since F8 cell is correctly ranked with a "1" value.

    Thanks again for your help

  5. #5
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2016
    Posts
    313

    Re: Need to rank a columns contents based on another column

    Thanks for the response, I tried it out but it didn't give the results I needed - It gave a ranking for all rows not just the ties. I did get almost what I needed from Macro2 from Mehmetcik and I posted a reply listing one change needed.

    Thanks again.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Need to rank a columns contents based on another column

    Not really sure what you want then. Below shows how I used my suggestion to rang...
    A
    B
    C
    D
    E
    F
    G
    1
    Player Name MP Game W/L Ratio Points W/L Ratio Place TieBreak Ranking Mine
    2
    Raquel Welch
    20
    1.67
    1.11
    1
    0
    1
    3
    Bill Wallace
    19
    1.32
    1.04
    2
    0
    2
    4
    Janet Leigh
    18
    1.29
    1.06
    3
    1
    3
    5
    Jay Boateng
    18
    1.04
    0.97
    3
    3
    4
    6
    Toni Tenille
    18
    1.05
    1
    3
    2
    5
    7
    Barry Scott
    17
    0.96
    1
    6
    0
    6
    8
    Clark Gable
    16
    1
    1.02
    7
    1
    7
    9
    Alex Trebek
    16
    0.91
    1.01
    7
    2
    8
    10
    Sean Hernandez
    16
    1.05
    1.01
    7
    2
    9
    11
    Shawn Sapp
    14
    0.84
    0.96
    10
    1
    10
    12
    Jean-Marie Kanani
    14
    0.8
    0.94
    10
    2
    11
    13
    Mark Masters
    12
    0.5
    0.88
    12
    0
    12


    If this was not what you wanted, then what did you want?

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need to rank a columns contents based on another column

    All you need do is to insert a Min ( Minimum Instruction ) Minimum of ( Calculated and 2)

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2016
    Posts
    313

    Re: Need to rank a columns contents based on another column

    Sorry, I'll try to explain the issue more clearly.

    In the attached spreadsheet column E signifies the order of finish for players in a tournament. cell E2 has a value of "1",
    E3 has value "2", then E4, E5 and E6 all have value of "3". This means those 3 players tied for 3rd place.

    So I want all the tied players for one position to be ranked descending based on value of column D. If one or more players
    involved in a tie have the same value in column D, they should have the same ranking.

    Therefore the 3 players tied for 3rd place should be ranked as follows: E4 Ranked "1" E5 Ranked "2" E6 Ranked "3" based
    on column D'S descending values.

    In the attachment there is a tie for seventh place among 3 players. Cell E8 is the highest value of the three (col D)
    and gets a ranking of "1", E9 and E10 have the same value in col. D and both should have a ranking of "2".

    If for example we have a 5 player tie for first place and the all had same value in column D then all 5 would have a
    ranking of "1"

    Macro2 results are in col F in the attachment - I've add a column H to show the values I'm wanting to get. I've
    hi-lited the cells in column H which are different from the macro's results in col. F.

    Thanks so much for your help.
    Attached Files Attached Files
    Last edited by pongmeister; 01-27-2016 at 12:38 AM. Reason: Explain sample error

  9. #9
    Forum Contributor
    Join Date
    07-20-2015
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2016
    Posts
    313

    Re: Need to rank a columns contents based on another column

    Just an additional note - In my attachment where I put expected values in column H I showed cell H2 as blank value but should have been a zero.

+ 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: 1
    Last Post: 11-30-2013, 06:48 AM
  2. Macro to Shift Columns based on Rank Value
    By eemrun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2013, 07:11 AM
  3. [SOLVED] Rank function, based on 2 criteria / columns
    By Hein in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-31-2013, 11:34 PM
  4. [SOLVED] RANK function - to return data based on 2 different columns
    By Adsup01 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-30-2013, 08:17 PM
  5. Help creating a column based on the contents of three other columns
    By iherzog0 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-07-2012, 11:08 AM
  6. Adjusting Range Contents Based on contents of Three other columns
    By VTHokie11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2012, 01:55 PM
  7. Rank based on result of another column
    By cadge in forum Excel General
    Replies: 2
    Last Post: 01-20-2012, 08:36 AM
  8. Change Row to Column Based on Rank Function
    By oyz79 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-17-2011, 11:45 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