Don't use this anymore but did help in the pasted to win some money in keno ,
This is set to look for 3 numbers but can be changed to look for 6 7 or 8 numbers ,,,
How to use
Past the past winning lotto numbers in A1 to whatever , then activate sheet of numbers and call it Numbers if you don't the vba wont work
Good Luck!
The Excel VBA
----------------------------------------------------------------------------
Public Sub Highlight_Repetitions()
Const REPEATS = 3
Dim Rw1 As Range, Rw2 As Range
Dim check_array As Variant, match_array As Variant
For Each Rw1 In [Numbers].Rows
If Rw1.Row >= [Numbers].Rows.Count \ 2 Then Exit For
check_array = Rw1.Value
For Each Rw2 In [Numbers].Rows
If Rw2.Row > Rw1.Row Then
match_array = Rw2.Value
repetitions = 0
repeat_string = vbNullString
For i = LBound(check_array, 2) To UBound(check_array, 2)
If i <= REPEATS + repetitions Then
For j = LBound(match_array, 2) To UBound(match_array, 2)
If check_array(1, i) = match_array(1, j) Then
repetitions = repetitions + 1
repeat_string = repeat_string & check_array(1, i) & " , "
End If
Next
Else
Exit For
End If
Next
If repetitions >= REPEATS Then
'MsgBox "Rows " & Rw1.Row & " and " & Rw2.Row & " have repetitions"
Rw1.Cells(1, 1).Offset(, 26).Value = Left(repeat_string, Len(repeat_string) - 3)
Rw2.Cells(1, 1).Offset(, 26).Value = Left(repeat_string, Len(repeat_string) - 3)
If Rw1.Cells(1, 1).Offset(, 28).Value = vbNullString Then
Rw1.Cells(1, 1).Offset(, 28).Value = Rw2.Row
Else
Rw1.Cells(1, 1).Offset(, 28).Value = Rw1.Cells(1, 1).Offset(, 28).Value & " , " & Rw2.Row
End If
If Rw2.Cells(1, 1).Offset(, 28).Value = vbNullString Then
Rw2.Cells(1, 1).Offset(, 28).Value = Rw1.Row
Else
Rw2.Cells(1, 1).Offset(, 28).Value = Rw2.Cells(1, 1).Offset(, 28).Value & " , " & Rw1.Row
End If
End If
End If
Next
Next
End Sub