+ Reply to Thread
Results 1 to 5 of 5

How to break ranked ties by comparing data in other columns

Hybrid View

  1. #1
    Registered User
    Join Date
    02-09-2023
    Location
    Marietta, GA
    MS-Off Ver
    Office 365
    Posts
    3

    How to break ranked ties by comparing data in other columns

    I'm trying to develop a spreadsheet that will help me to score vertical jump competitions (pole vault or high jump) at track meets. Each competitor is allowed 3 attempts to successfully clear the bar at each height. Some heights are cleared on the first attempt, some on the second and some on the third. If all 3 attempts fail, the competitor is out of the competition.

    I've been able to get the results to rank the competitors by their highest bar cleared, but in order to break any ties, the rules look at the competitors who are tied (i.e. cleared the same maximum height) and then proceed to compare how many times they failed to clear the bar at the previous height. If they have the same number of misses (failed attempts) at that previous height, you then look at the next previous height and continue this until you determine that one competitor had fewer misses at a height and that person is then ranked above the other.

    In the attached file, Vaulters 003 and 008 both cleared 14' 0" and then were unsuccessful trying to clear 14' 6". When you look at the number of misses at their final successful height (14' 0"), they each have 2 misses. You then go back to 13' 6" and they Vaulter 003 had 1 miss while Vaulter 008 had none. Therefore, Vaulter 008 would be ranked higher (4th place) than Vaulter 003 (5th place).

    How can I use the number of misses to break these ties? Is it a formula issue, or would this be done in VBA?

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

    Re: How to break ranked ties by comparing data in other columns

    Since formula solution would be complicated, I would suggest a VBA solution.
    Alt-F11 to open VBA window, insert/module, paste below code into. Then hit F5 to run.
    Save as file with .xlsm format.
    PHP Code: 
    Option Explicit
    Sub test
    ()
    Dim lr&, i&, j&, k&, c&, rngarr(), sumn
    lr 
    Cells(Rows.Count"A").End(xlUp).Row
    rng 
    Range("C4:K" lr).Value
    ReDim arr
    (1 To UBound(rng), 1 To 2)
    For 
    1 To UBound(rng)
        
    sum 000
        
    For 1 To 9
            
    If IsNumeric(rng(ij)) And rng(ij) <> "" Then
                n 
    = (10 ^ -rng(ij)) * 10 j
                sum 
    sum n
                k 
    IIf(rng(ij) = 0j1)
                
    1
            End 
    If
        
    Next
        arr
    (i2) = sum
        arr
    (i1) = IIf(sum 0"DNS"IIf(1"NH"Cells(32).Value))
    Next
    Range
    ("L4").Resize(UBound(rng), 2).Value arr
    For 1 To UBound(arr)
        
    arr(i2) = WorksheetFunction.Rank(arr(i2), Range("M4:M" lr))
        If 
    arr(i1) = "DNS" Then arr(i2) = "---"
    Next
    Range
    ("L4").Resize(UBound(rng), 2).Value arr
    End Sub 
    Quang PT

  3. #3
    Registered User
    Join Date
    02-09-2023
    Location
    Marietta, GA
    MS-Off Ver
    Office 365
    Posts
    3

    Re: How to break ranked ties by comparing data in other columns

    bebo021999:

    Thank you for this help! It works great for the file I sent. My actual file has space for up to 200 competitors. I tried adding lines for more competitors in my example file and it still worked great until I entered another person whose result was "NH". Then the rankings didn't seem to work. I've attached a revised file that has 21 competitors so show the issue. If a person's result is "NH", I'd like them to automatically be assigned last place (not counting anyone who Did Not Start, "DNS"). Any suggestions on how to change the VBA code would be greatly appreciated.
    Attached Files Attached Files

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

    Re: How to break ranked ties by comparing data in other columns

    Try again:
    PHP Code: 
    Option Explicit
    Sub test
    ()
    Dim lr&, i&, j&, k&, c&, rngarr(), sumn
    lr 
    Cells(Rows.Count"A").End(xlUp).Row
    rng 
    Range("C4:K" lr).Value
    ReDim arr
    (1 To UBound(rng), 1 To 2)
    For 
    1 To UBound(rng)
        
    sum 000
        
    For 1 To 9
            
    If IsNumeric(rng(ij)) And rng(ij) <> "" Then
                n 
    = (10 ^ -rng(ij)) * 10 j
                sum 
    sum n
                k 
    IIf(rng(ij) = 0j1)
                
    1
            End 
    If
        
    Next

    'new added
        arr(i, 2) = IIf(c = 1, 0, sum)
    '
    -------------

        
    arr(i1) = IIf(sum 0"DNS"IIf(1"NH"Cells(32).Value))
    Next
    Range
    ("L4").Resize(UBound(rng), 2).Value arr
    For 1 To UBound(arr)
        
    arr(i2) = WorksheetFunction.Rank(arr(i2), Range("M4:M" lr))
        If 
    arr(i1) = "DNS" Then arr(i2) = "---"
    Next
    Range
    ("L4").Resize(UBound(rng), 2).Value arr
    End Sub 

  5. #5
    Registered User
    Join Date
    02-09-2023
    Location
    Marietta, GA
    MS-Off Ver
    Office 365
    Posts
    3

    Re: How to break ranked ties by comparing data in other columns

    bebo021999:

    It looks like that did it! This is a HUGE help. Thank you so much.

+ 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. Returning Names in Ranked order WITH Ties
    By jonsg in forum Excel General
    Replies: 4
    Last Post: 07-25-2018, 10:11 PM
  2. [SOLVED] Break Ties RANK Function
    By bridgetjean in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-21-2016, 11:49 PM
  3. [SOLVED] Use second column to break ranking ties
    By swallis in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 10-13-2015, 05:36 PM
  4. Retrieving ranked data with ties
    By makinwaves in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-06-2014, 03:06 AM
  5. How to break ties in the RANK function
    By ducecoop in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-20-2013, 12:38 AM
  6. Break Ranking Ties with multiple Criteria
    By Mysore in forum Excel General
    Replies: 9
    Last Post: 01-10-2012, 05:56 AM
  7. How to use RANK to break multiple ties.
    By Brian in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-03-2005, 02:06 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