+ Reply to Thread
Results 1 to 13 of 13

Dynamic sort not working - Tie Breaker

  1. #1
    Registered User
    Join Date
    07-24-2014
    Location
    Plano, Texas
    MS-Off Ver
    2013
    Posts
    19

    Dynamic sort not working - Tie Breaker

    Hello, I have attached a sample of my document for a visual... but basically I have this table with all 50 states and a few US territories and I have pulled the Total contract value and number of deals from another sheet using SUMIF and COUNTIF.. now I want to dynamically sort them by total contract value highest to lowest, but I am having trouble figuring out the tie breaker. I made the same table twice - have them ranked in the first table and am now using vlookup to put them in order 1 to 50


    I am currently using a VLOOKUP, VLOOKUP in table 2 because I thought it may fix my tie breaker issue? but I am not exactly sure why I am using it twice
    I am currently using RANK and COUNTIF in table 1 - but that is not breaking the ties - for example Arkansas and Colorado are both 1
    I spent days trying to teach myself to use the SMALL function - epic failure

    I was wondering if any of you may have a better idea of how I can get this dynamic rank to work

  2. #2
    Registered User
    Join Date
    07-24-2014
    Location
    Plano, Texas
    MS-Off Ver
    2013
    Posts
    19

    Re: Dynamic sort not working - Tie Breaker

    mY APOLOGIES, HERE IS THE DOCUMENT
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic sort not working - Tie Breaker

    A simple error, you need the first D3 to be anchored

    =RANK($D3,$D$3:$D$62)+COUNTIF($D$3:D3,D3)-1
    copied down
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Dynamic sort not working - Tie Breaker

    Your formula in column A should be

    =RANK($D3,$D$3:$D$62)+COUNTIF(D$3:D3,D3)-1

  5. #5
    Registered User
    Join Date
    07-24-2014
    Location
    Plano, Texas
    MS-Off Ver
    2013
    Posts
    19

    Re: Dynamic sort not working - Tie Breaker

    Thank you! Now I was wondering how I can insert my own tie breaker - I assume this tie breaker is just based on the one listed first in my original table... how would I make the tie breaker like this: if Total contract value is tied, then list the state with highest total contract value divided by number of deals = D/C = average contract value?

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic sort not working - Tie Breaker

    I would make a helper column which you can hide afterwards

    =IF(ISNUMBER(D3),D3+D3/(C3*1000),"")

    Then refer to that column

    =RANK($E3,$E$3:$E$62)+COUNTIF($E$3:E3,E3)-1
    Does that work for you?

  7. #7
    Registered User
    Join Date
    07-24-2014
    Location
    Plano, Texas
    MS-Off Ver
    2013
    Posts
    19

    Re: Dynamic sort not working - Tie Breaker

    Could you explain what that is doing? If D3 is a number then display as D3+D3/C3*1000?

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Dynamic sort not working - Tie Breaker

    That could end up throwing off the original rank.

    If they were originally tied for 2nd, then adding that value to the original contract could bump it up to 1st.

    Perhaps adding only a decimal value would minimize that risk as much as possible..

    =IF(ISNUMBER(D3),D3+(1/C3),"")
    Last edited by Jonmo1; 08-04-2014 at 01:17 PM.

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic sort not working - Tie Breaker

    Depends on the original range, that's why I divided by 1000. It might require dividing by 100000 to play it safe.

    See example. The added term adds an otherwise negligible amount so that ties can be broken.
    Attached Files Attached Files
    Last edited by ChemistB; 08-04-2014 at 01:22 PM.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Dynamic sort not working - Tie Breaker

    This also eliminates the need for adding the countif to the rank funciton.

    E3 and filled down is
    =IF(ISNUMBER(D3),D3+(1/C3),"")

    A3 and filled down is
    =RANK($E3,$E$3:$E$62)

  11. #11
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Dynamic sort not working - Tie Breaker

    There's still the possibility that two states will have the same Dollar amount and the same number of deals so I would keep the COUNTIF

  12. #12
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Dynamic sort not working - Tie Breaker

    Good point.

  13. #13
    Registered User
    Join Date
    07-24-2014
    Location
    Plano, Texas
    MS-Off Ver
    2013
    Posts
    19

    Re: Dynamic sort not working - Tie Breaker

    Awesome - works like a charm. I left the countif in there. Thanks for all of your help

+ 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] dynamic list needs a dynamic sort
    By James C in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-13-2014, 03:56 PM
  2. [SOLVED] Sort dynamic range alphabetically - cant get it working
    By Taktiker in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-08-2013, 11:35 AM
  3. [SOLVED] Dynamic sort with dynamic sort criteria
    By david.herrera1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2012, 11:06 AM
  4. Tie-Breaker (sort of) For Mode Function
    By gandolff in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-18-2009, 06:37 PM
  5. Excel Sort Tie Breaker
    By Casper in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-08-2006, 07:50 PM

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