Trying To Break ties

Chesley

New Member
Joined
Jan 12, 2016
Messages
14
I have a column with a number of integers in column A, which has a number of ties in it. I need to be able to break the ties by using values in B, and if there is still ties, then got column c, and again, if there is ties go to column D,etc ( up to 7 columns with values to be used to break the Ties). I'm trying to do this in vba, however being new to vba , I haven't been able to get this to work, I find it gets to convoluted when I get to checking the second column of values to try and break the ties, I have all values stored in arrays. As you can see below the first "77" tie is broken by the next column "36" but the next two 77 ties are not broken until the last possible check.

77 36 24 12 41 27 13 5
77 37 23 11 40 27 13 4
77 37 23 11 40 27 13 5

I've been trying to resolve this for a couple of weeks, sad to say I haven't, but the good news is I'm learning a lot about Excel VBA. If someone can point me in the right direction it would be appreciated.

Thanks
 
Welcome to the MrExcel board!

I don't think you are giving us enough information to provide the best possible solution.

What are each of your arrays called?
What dimensions do they have?
How were they populated?
Is there a particular reason why are they all in separate arrays and not in a single, 2-dimensional array?
Are there maximum and/or minimum values for the numbers in each array (column)?
etc

Could you share your existing code & sheet layout? My signature block below has help on that.
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Thanks Mike, but I have no clue to the above code you provided or how to implement. Did I mention I'm new to excel VBA. :). I'm taking some courses online, but I'm definitely not up to understanding what you've done here. BUT, learning is good, so can you provide some explanation with your provided code.

Thanks
 
Upvote 0
Peter, here is additional info. I have one sub that will check values if there are ties it then passes an array with those address to another sub, in that sub I collect data from table (sum of values in specific ranges) which I also put into arrays, these are what is used to break the ties, so the dimension of the arrays depends on how many ties there are. I'm looking at 2D arrays now, but remember I'm just learning. This project is to run a golf tournament, so the values in the cells are all integers, (depending of course how bad and how honest a golfer is :) )
Thanks

Code:
Dim BckLastSix As Integer, BckLastThree As Integer, BckNineTotal As Integer, BckNineLastHole As Integer
Dim BckLastSixArr() As Long, BckLastThreeArr() As Integer, BckNineTotalArr() As Variant, BckNineLastHoleArr() As Integer
Dim BckLastSixAdd() As String, BckLastThreeAdd() As String, BckNineTotalAdd() As Variant, BckNineLastHoleAdd() As String

Dim FrontLastSix As Integer, FrontLastThree As Integer, FrontNineTotal As Integer, FrontNineLastHole As Integer
Dim FrontLastSixArr() As Integer, FrontLastThreeArr() As Integer, FrontNineTotalArr() As Integer, FrontNineLastHoleArr() As Integer
Dim FrontLastSixAdd() As String, FrontLastThreeAdd() As String, FrontNineTotalAdd() As String, FrontNineLastHoleAdd() As String
 
Upvote 0
That doesn't really help as i still have no idea what array is what, nor why we have all individual arrays.
You didn't answer my question about minimum/maximum values, but as we now know it is about golf scores, I assume all values are not only integers, but are all 3 digits or less. Correct?

Are all the values that you have read into your arrays actually in a table somewhere on your sheet? If so, can you tell us where the table is and which column is the primary value, which column is the first tie-break column, which column is the second tie-break column etc?

The reason that I am asking is that for what I have in mind, what you have done by putting all the values into separate arrays may not be the best way to resolve the problem you are now posing & I would like to at least consider alternatives.

If the values in your arrays are not actually already in a table on the sheet, then please advise

- Which array is the primary array, which is first tie-break array, second tie-break array etc.?

- Are these arrays one-dimensional (that is, I access the third element as, say, FrontLastSixArr(3)) or two-dimensional (that is, I access the third element as, say, FrontLastSixArr(3,1))

- Can you confirm that all 8 arrays are exactly the same size as each other?
 
Last edited:
Upvote 0
Peter hear is my code for first sub, it checks each value in a column and colors cells if it is the low value, if there are ties it passes the address of the cells to another sub, also included. The second sub gathers and or calculates the values needed to break ties, I had a bunch of code in this sub where I tried to resolve the ties but couldn't get it to work, so I deleted it and I am now trying to work out using 2D array.


Code:
Sub CheckforDups()
Static i ' set as static so It will keep its value when breaktie sub returns

Dim J As Integer, y As Integer, x As Integer, z As Integer, lr As Long, Lvalue As Long, cnt As Integer
Dim colgross As Long, rowstart As Long, cntDups As Integer, lowValue As Integer, lowValuecnt As Integer
Dim MyRge As Range, adr As String
Dim cadr() As String, MyAddAry() As String
Dim origadr As String
lr = Cells(Rows.Count, 9).End(xlUp).Row 'get last row
If i > 1 Then GoTo BYPASS
'With Sheet2
'        lr = .Cells(.Rows.Count, "N").End(xlUp).Row
'End With
i = 1
BYPASS:
colgross = 26
rowstart = 10
Set MyRge = Range(Cells(rowstart, colgross), Cells(lr, colgross))
cnt = MyRge.Count ' count cells in Range
'lowValue = WorksheetFunction.Min(MyRge) ' get min value in range
'lowValuecnt = WorksheetFunction.CountIf(MyRge, lowValue) 'count the number of min values
ReDim cadr(1 To cnt)
For i = i To cnt
    z = 0
    Lvalue = MyRge(i, 1).Value ' get value in first cell
    MyRge(i, 1).Select ' just to make sure i got the right cell
    origadr = MyRge(i, 1).Address
    lowValue = WorksheetFunction.Small(MyRge, i) ' get min value in range in each for loop
    lowValuecnt = WorksheetFunction.CountIf(MyRge, lowValue) 'count the number of min values
    If Lvalue = lowValue And lowValuecnt = 1 Then
 ' a play can only be low gross or low net not both, always get 1st low gross first
        If Range(origadr).Offset(-1, 0).Interior.ColorIndex = 3 Then
            Range(origadr).Interior.ColorIndex = 4
            Range(origadr).Offset(0, 1).Interior.ColorIndex = 3
            Range(origadr).Offset(0, 2).Value = 0
            Range(origadr).Offset(0, 3).Value = 1
        Else
        Range(origadr).Interior.ColorIndex = 3
        Range(origadr).Offset(0, 1).Interior.ColorIndex = 4
        Range(origadr).Offset(0, 2).Value = 1
        Range(origadr).Offset(0, 3).Value = 0
        End If
    End If
  ' try using find and findnext to get the addresses of cells with the same value
    If lowValuecnt = 1 Then GoTo RESTART
    i = i + lowValuecnt
   For J = 1 To cnt 'loop thru remaining cells to find duplicate values
         If MyRge(J, 1).Value = Lvalue Then 'And MyRge(J, 1).Address <> origadr Then ' comapring cell addresses
           adr = MyRge(J, 1).Address
           cadr(J) = adr
           z = z + 1
        End If
    
    If z = lowValuecnt Then GoTo PASSARRAY
    Next
RESTART:
Next
PASSARRAY:
For y = LBound(cadr) To UBound(cadr) ' all this to resize and copy values from one array to another
    If cadr(y) = "" Then
    Else
        x = x + 1
    End If
Next
Erase MyAddAry()
ReDim MyAddAry(1 To x)
x = 0
For y = LBound(cadr) To UBound(cadr)
    If cadr(y) = "" Then
    Else
        x = x + 1
        MyAddAry(x) = cadr(y)
    End If
Next

breakTie MyAddAry() 'Pass duplicate addresses to breaktie Sub
End Sub


Code:
Sub breakTie(MyAddAry() As String)


Dim myval As Variant
Dim i As Integer, J As Integer, k As Integer, y As Integer, x As Integer, cnt As Integer, lows As Integer
Dim adr As String
Dim jj As Integer, kk As Integer
Dim colgross As Long, rowstart As Long
Dim tmpAdd As String, tmpVal As Integer
Dim ItemElement As Long, tmpindex As Long
Dim lCtr As Long
Dim lTop As Long
Dim lBottom As Long
Dim bckNineTotalLows As Variant

Dim BckLastSix As Integer, BckLastThree As Integer, BckNineTotal As Integer, BckNineLastHole As Integer
Dim BckLastSixArr() As Long, BckLastThreeArr() As Integer, BckNineTotalArr() As Variant, BckNineLastHoleArr() As Integer
Dim BckLastSixAdd() As String, BckLastThreeAdd() As String, BckNineTotalAdd() As Variant, BckNineLastHoleAdd() As String

Dim FrontLastSix As Integer, FrontLastThree As Integer, FrontNineTotal As Integer, FrontNineLastHole As Integer
Dim FrontLastSixArr() As Integer, FrontLastThreeArr() As Integer, FrontNineTotalArr() As Integer, FrontNineLastHoleArr() As Integer
Dim FrontLastSixAdd() As String, FrontLastThreeAdd() As String, FrontNineTotalAdd() As String, FrontNineLastHoleAdd() As String
Dim myArry() As Variant

ReDim BckLastSixArr(LBound(MyAddAry) To UBound(MyAddAry))
ReDim BckLastThreeArr(LBound(MyAddAry) To UBound(MyAddAry))
ReDim BckNineTotalArr(LBound(MyAddAry) To UBound(MyAddAry))
ReDim BckNineLastHoleArr(LBound(MyAddAry) To UBound(MyAddAry))

ReDim BckLastSixAdd(LBound(MyAddAry) To UBound(MyAddAry))
ReDim BckLastThreeAdd(LBound(MyAddAry) To UBound(MyAddAry))
ReDim BckNineTotalAdd(LBound(MyAddAry) To UBound(MyAddAry))
ReDim BckNineLastHoleAdd(LBound(MyAddAry) To UBound(MyAddAry))

ReDim FrontLastSixArr(LBound(MyAddAry) To UBound(MyAddAry))
ReDim FrontLastThreeArr(LBound(MyAddAry) To UBound(MyAddAry))
ReDim FrontNineTotalArr(LBound(MyAddAry) To UBound(MyAddAry))
ReDim FrontNineLastHoleArr(LBound(MyAddAry) To UBound(MyAddAry))

ReDim FrontLastSixAdd(LBound(MyAddAry) To UBound(MyAddAry))
ReDim FrontLastThreeAdd(LBound(MyAddAry) To UBound(MyAddAry))
ReDim FrontNineTotalAdd(LBound(MyAddAry) To UBound(MyAddAry))
ReDim FrontNineLastHoleAdd(LBound(MyAddAry) To UBound(MyAddAry))
ReDim myArry(LBound(MyAddAry) To UBound(MyAddAry), 1 To 8)

'################### Collect  all values to break ties, last nine, sum of last 6, and sum of last 3 etc.
For i = LBound(MyAddAry) To UBound(MyAddAry)
    BckNineTotal = 0
    BckLastSix = 0
    BckLastThree = 0
    BckNineLastHole = 0
  
    FrontLastSix = 0
    FrontLastThree = 0
    FrontNineTotal = 0
    FrontNineLastHole = 0
    adr = MyAddAry(i)
    If adr = "" Then ' just in case an array element does not have a cell address
    Else
        Range(adr).Select 'just a check for me not required
'Get back nine values for evaluation
        BckNineTotal = Range(adr).Offset(0, -1) ' get backnine total
'        BckNineTotalAdd(i) = MyAddAry(i)
        BckNineLastHole = Range(adr).Offset(0, -3) 'get last hole value
'        BckNineLastHoleAdd(i) = MyAddAry(i)
        For k = 3 To 8 ' Get total scores of the last six holes
            BckLastSix = BckLastSix + Range(adr).Offset(0, -k)
        Next k
'        BckLastSixAdd(i) = MyAddAry(i)
        k = 0
        For k = 3 To 5 'Get total of the last 3 holes
            BckLastThree = BckLastThree + Range(adr).Offset(0, -k)
        Next k
'        BckLastThreeAdd(i) = MyAddAry(i)
        k = 0
'Get front nine values for evaluation
        FrontNineTotal = Range(adr).Offset(0, -2) 'get front nine total
'        FrontNineTotalAdd(i) = MyAddAry(i)
        FrontNineLastHole = Range(adr).Offset(0, -12) ' get last hole value on front nine
'        FrontNineLastHoleAdd(i) = MyAddAry(i)
        For k = 12 To 17 ' Get total scores of the last six holes on the front nine
            FrontLastSix = FrontLastSix + Range(adr).Offset(0, -k)
        Next
'        FrontLastSixAdd(i) = MyAddAry(i)
        k = 0
        For k = 12 To 14 'Get total of the last 3 holes on the front 9
            FrontLastThree = FrontLastThree + Range(adr).Offset(0, -k)
        Next
    BckLastSixArr(i) = BckLastSix
    BckLastThreeArr(i) = BckLastThree
    BckNineTotalArr(i) = BckNineTotal
    BckNineLastHoleArr(i) = BckNineLastHole
    FrontLastSixArr(i) = FrontLastSix
    FrontLastThreeArr(i) = FrontLastThree
    FrontNineTotalArr(i) = FrontNineTotal
    FrontNineLastHoleArr(i) = FrontNineLastHole
    End If
  
        myArry(i, 1) = adr
        myArry(i, 2) = BckNineTotal
        myArry(i, 3) = BckLastSix
        myArry(i, 4) = BckLastThree
        myArry(i, 5) = BckNineLastHole
        myArry(i, 6) = FrontLastSix
        myArry(i, 7) = FrontLastThree
        myArry(i, 8) = FrontNineLastHole

    
Next
' Check back nine total for low value
J = 0 '########################################################################

lows = WorksheetFunction.Min(BckNineTotalArr)
tmpVal = UBound(MyAddAry) 'count of how many addresses were passed
For x = LBound(MyAddAry) To UBound(MyAddAry)
    With Application.WorksheetFunction
    bckNineTotalLows = .Min(myArry(x, 2))
    End With
    For k = 1 To UBound(MyAddAry)
       If myArry(k, 2) = lows Then
            xx = xx + 1
       End If
    Next
    If bckNineTotalLows = lows Then
        J = J + 1
        adr = myArry(x, x)
    Else
        y = y + 1 'need to do check on remaining values
    End If
    If J = 1 Then
        Range(adr).Select
        Range(adr).Interior.ColorIndex = 3
        Range(adr).Offset(0, 1).Interior.ColorIndex = 4
        Range(adr).Offset(0, 2).Value = 1
        Range(adr).Offset(0, 3).Value = 0
    ElseIf J > 1 Then 'if more then 1 low value
        lows = WorksheetFunction.Min(BckLastSixArr)
        With Application.WorksheetFunction
            bckSixTotalLows = .Min(myArry(x, 3))
        End With
        If bckNineTotalLows = lows Then
            J = J + 1
            adr = myArry(x, x)
        Else
            y = y + 1 'need to do check on remaining values
        End If
        
        
    End If

Next

Application.Run "Sheet2.CheckforDups"
End Sub
 
Upvote 0
What about these?

.. I assume all values are not only integers, but are all 3 digits or less. Correct?

Are all the values that you have read into your arrays actually in a table somewhere on your sheet? If so, can you tell us where the table is and which column is the primary value, which column is the first tie-break column, which column is the second tie-break column etc?


If the values in your arrays are not actually already in a table on the sheet, then please advise

- Which array is the primary array, which is first tie-break array, second tie-break array etc.?

- Are these arrays one-dimensional (that is, I access the third element as, say, FrontLastSixArr(3)) or two-dimensional (that is, I access the third element as, say, FrontLastSixArr(3,1))

- Can you confirm that all 8 arrays are exactly the same size as each other?
 
Upvote 0
Peter, All values are integers and all three digits or less. Not all values are in a table, the ones that are, are the final score(77), the out score(BckNineTotalArr), the back nine last hole(BckNineLastHoleArr), the front nine total(FrontNineTotalArr) and the front nine last hole(FrontNineLastHoleArr) , the back nine last six (BckLastSixArr), bac nine last 3(BckLastThreeArr), front nine last six (FrontLastSixArr), front last three(FrontLastThreeArr) are calculated wit the for loops in the second sub, using the variables BckLastSix, BckLastThree, FrontLastSix, FrontLastThree. The colums are setup like this. The "MyAddAry" contains the addresses gathered in the first sub, they are the address of the first ties encountered , which are then passed to the second sub to resolve the ties, when the second sub resolves the ties( which isn't working correctly yet) control is passed back to the first sub which will(at this point) color cells until it encounters the next set of ties and pass to the second sub. The order of breaking the ties should be the in score (BckNineTotalArr), the back last six calculated total(BckLastSixArr), back last three calculated score(BckLastThreeArr),the back last hole (BckNineLastHoleArr), then (FrontLastSixArr),(FrontLastThreeArr) both calculated, and the front last hole(FrontNineLastHoleArr). All arrays are one dimensional except " myArry" which is my latest attempt at 2d arrays.All arrays are the same size because the data they holed are derived from the number of addresses passed to the second sub in array "MyAddAry",the ties.
Hope this answers all your questions.
Thanks Again
Ches

# First Last HDCPSkins 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Out In Total Net
1 Gary A 3 Y 6 3 4 5 3 4 5 4 4 4 4 4 4 5 4 4 4 4 38 37 75 72
2 GaryB 4 Y 6 3 4 5 3 4 5 4 4 4 4 4 5 5 3 4 5 4 38 38 76 72
3 me C 4 Y 4 6 4 5 5 5 4 4 4 6 5 4 3 4 3 3 3 5 41 36 77 91
4 Gary 4 Y 5 5 4 5 4 5 4 4 5 4 4 4 3 5 4 4 3 5 41 36 77 90
5 Gary x 4 Y 2 3 3 3 5 5 3 6 5 5 4 5 3 4 4 4 3 10 35 42 77 92
 
Upvote 0
Getting a slightly clearer picture but a few more questions, sorry. Please answer each as clearly & directly as possible.
I do not need to see any code related to the questions.

1. I may have missed it somewhere, but what is the actual name of the array that holds the final scores (the 77 values from the first column of your post #1 table)? That is, the primary sorting array.

2. What is to happen if two (or more) players have identical values right through all those arrays?
- For example, what position would we give to the last 2 rows of your post #1 table if both those rows had "4" in the final column?
- Would we arbitrarily split them and give, say the first of those position 2 and the second one of them position 3?
- Or would we give them both position 2 (ie equal)?
- If we give them both position 2 and there was further player with worse scores, would that player then get position 4 (nobody gets pos 3) or position 3 (being the next number available)?

3. Could you make up another similar sample table to post #1 with a few more rows, say 8-10, and include a 9th column that shows the results you would expect?
When making the table, be sure to include at least one example of the issue discussed in point 2 in this post.

I do understand that you don't actually have a table just like post #1, but it (hopefully) will ..
a) Demonstrate the issues I want clarified, and
b) Give me a means of filling some sample arrays without having to get to understand all of what your code is doing up to that point. :)
 
Upvote 0
Hey Peter, here is the info you requested. I didn't put the final scores into an array just the addresses of the ties (MyAddAry). If there were ties all the way through we would have to say its a tie, so they would hold positions 2 & 3 and the next would be position 4. In the table below note: the first 77would be 3rd (by lower score in the Last Six holes) , the last 77 would be 5th because (Because "IN" score is higher), these 2 "84" scores are identical for the parameters we check within the code. However we never checked the first three holes, so by the tournament rules we would go hole by hole from 18 to 1, so actually with the data provided, the 1st 84 would be 8th, But if they were tied all the way from 18 to 1 then , we would ask those two players to have a playoff.

# First Last HDCP Skins 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Out In Total Net
1 A AA 3 Y 6 3 4 5 3 4 5 4 4 4 4 4 4 5 4 4 4 4 38 37 75 72 1ST Low Gross
2 B BB 4 Y 6 3 4 5 3 4 5 4 4 4 4 4 5 5 3 4 5 4 38 38 76 72 2nd
3 C CC 4 Y 4 6 4 5 5 5 4 4 4 6 5 4 3 4 3 3 3 5 41 36 77 73 3rd
4 D DD 5 Y 5 5 4 5 4 5 4 4 5 4 4 4 3 5 4 4 3 5 41 36 77 72 4th
5 E EE 6 Y 2 3 3 3 5 5 3 6 5 5 4 5 3 4 4 4 3 10 35 42 77 71 5th
6 F FF 7 N 4 5 5 5 3 5 4 4 5 6 4 6 3 3 4 4 3 5 40 38 78 71 6th
7 G GG 8 Y 6 5 2 6 5 6 5 4 5 5 3 3 5 5 4 4 6 4 44 39 83 75 7th
8 H HH 8 N 4 7 4 4 5 5 5 4 5 5 5 5 3 4 5 5 4 5 43 41 84 76 8th
9 I II 6 N 4 6 5 4 5 5 5 4 5 5 5 5 3 4 5 5 4 5 43 41 84 78 9th
10 J JJ 7 N 6 5 4 4 3 6 5 6 3 6 7 4 3 5 5 3 3 6 42 42 84 77 10th
11 K KK 9 N 6 5 3 5 5 5 5 4 5 4 3 4 7 4 4 5 7 5 43 43 86 77 11th
12 L LL 6 N 6 7 5 6 4 6 3 5 4 5 6 5 4 5 5 4 2 5 46 41 87 81 12th
 
Upvote 0
Hey Peter, here is the info you requested.
Unfortunately, it isn't quite. :)


If there were ties all the way through we would have to say its a tie, so they would hold positions 2 & 3 and the next would be position 4.
This isn't clear. The underlined part would indicate to me that both players would hold position 2 but the bold part is indicating one would be position 2 and one would be position 3.

The table is not what I asked for. I asked for a table like in post #1. That is, the final scores and the calculated results that are in your 7 arrays that will be used for tie-breaking.


In any case, trying to tie in with what you have already done I think will be too hard for me to get my head around. So, I'm starting from scratch. If it is of use to you, great. If not, it doesn't matter as it has been an interesting exercise for me anyway. :)

I am assuming ...
1. You do have a table somewhere in your worksheet that looks something like the one you have in post #19, and therefore the one I have below (though I have altered the data a little). If your data isn't in the columns I have or doesn't start in row 1 then that should be modifiable, either by you or by me.
2. If there is a complete tie between 2 players, say for second, then both players would get position 2 and the next player would get position 4.
3. You are not using the Net score, handicap or Skins value in any tie-breaking as that has not been mentioned anywhere as far as I have noticed.
4. You have a total of 27 criteria to determine the player positions. They are, in order of importance..

Total score
Back 9 total ('In' column in your sample data)
Last 6 back 9
Last 3 back 9
Last 1 back 9 (hole 18)
Front 9 total ('Out' column in your sample data) - Even though this was not mentioned in your tie-break order mentioned in post #17, see quote below
Last 6 front 9
Last 3 front 9
Last 1 front 9 (hole 9)
Each individual hole in reverse: 18, 17, 16, ..

The order of breaking the ties should be the in score (BckNineTotalArr), the back last six calculated total(BckLastSixArr), back last three calculated score(BckLastThreeArr),the back last hole (BckNineLastHoleArr), then (FrontLastSixArr),(FrontLastThreeArr) both calculated, and the front last hole(FrontNineLastHoleArr).

If any of my assumptions are incorrect, please post back with details.

Anyway, you might like to give this a try as a stand-alone code in a copy of your workbook.

Rich (BB code):
Sub Position_Golfers()
  Dim a, b, Pos, RowList
  Dim TieBreakColsArr(1 To 27)
  Dim i As Long, j As Long, LR As Long, rws As Long, Inc As Long
  Dim s As String
  Dim SL As Object
  
  TieBreakColsArr(1) = 21                     'TotalScoreCol
  TieBreakColsArr(2) = 20                     'BckTotalCols (In)
  TieBreakColsArr(3) = Evaluate("row(13:18)") 'BckLastSixCols
  TieBreakColsArr(4) = Evaluate("row(16:18)") 'BckLastThreeCols
  TieBreakColsArr(5) = 18                     'BckLastOneCol
  TieBreakColsArr(6) = 19                     'FrontTotalCols (Out)
  TieBreakColsArr(7) = Evaluate("row(4:9)")   'FrontLastSixCols
  TieBreakColsArr(8) = Evaluate("row(7:9)")   'FrontLastThreeCols
  TieBreakColsArr(9) = 9                      'FrontLastOneCol
  For i = 18 To 1 Step -1                     'Individual hole cols in reverse
    TieBreakColsArr(28 - i) = i
  Next i
  
  LR = Range("F" & Rows.Count).End(xlUp).Row
  a = Range("F2:Z" & LR).Value
  rws = UBound(a)
  ReDim b(1 To rws, 1 To 27)
  ReDim Pos(1 To rws, 1 To 1)
  Set SL = CreateObject("System.Collections.Sortedlist")
  
  For i = 1 To rws
    s = vbNullString
    For j = 1 To 27
      b(i, j) = Format(Application.Sum(Application.Index(a, i, TieBreakColsArr(j))), "000")
      s = s & "|" & b(i, j)
    Next j
    If SL.ContainsKey(s) Then
      SL(s) = SL(s) & " " & i
    Else
      SL.Add s, i
    End If
  Next i
  For i = 1 To SL.Count
    RowList = Split(SL.getByIndex(i - 1))
    For j = 0 To UBound(RowList)
      Pos(RowList(j), 1) = i + Inc & IIf(UBound(RowList) > 0, " (Play-off)", "")
    Next j
    If UBound(RowList) > 0 Then Inc = Inc + 1
  Next i
  Range("AB2").Resize(rws).Value = Pos
  Range("AB1").Value = "Pos"
End Sub

For original data in columns A:AA below, code has produced column AB values.

Excel Workbook
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1#FirstLastHDCPSkins123456789101112131415161718OutInTotalNetPos
21AAA3Y634534544444454444383775721
32BBB4Y634534544444553454383876722
43CCC4Y464555444654343335413677733 (Play-off)
54CCCCC4Y464555444654343335413677733 (Play-off)
65DDD5Y554545445444354435413677725
76EEE6Y2333553655453444310354277716
87FFF7N455535445646334435403878717
98GGG8Y652656545533554464443983758
109HHH8N474455545555345545434184769
1110III6N4654555455553455454341847810
1211JJJ7N6544365636743553364242847711
1312KKK9N6535555454347445754343867712
1413LLL6N6756463545654554254641878113 (Play-off)
1514MMM6N6756463545654554254641878113 (Play-off)
Sheet2
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,576
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top