this vba code below will find all 6 numbers that = 120
example you add the winning lotto numbers 3,10,12,15,39,41 and it = 120
and you like to know what are all 6 numbers that add up to 120
you will get an excel of 89714 lines of 6 numbers that add up to 120
and on line 37707 is the wining numbers lotto numbers : 3,10,12,15,39,41
SO now you like to work out how many time the winning numbers show out of 89714 lines
the run my script on just 3,10,12,15,39,41 and found this :
5 and 6 only once on line 37707
top 4 numbers found 17 and 16 times
3,12,15,41 17 times
3,10,15,41 17 times
3,12,15,39 17 times
10,12,15,39 16 times
top 3 numbers found 200,199,196 and 193 times
3,10,41 200 times
3,12,39 199 times
3,12,41 196 times
3,15,39 193 times
so i than ran the code to find all Patten's of 5 6 4 and 3 numbers out of 1..45 that = 120 in the 89714 lines
and found this ;
for 6 and 5 mostly showed once only
but 4 and 3
found 4 patten numbers
9,16,24,25 17 times
6,22,23,24 17 times
9,16,23,25 17 times
7,15,23,28 16 times
found 3 patten numbers
2,10,39 202 times
8,15,29 194 times
6,17,30 193 times
6,19,20 193 times
1,16,24 189 times
found 2 pairs numbers
5,22 1894 times
10,11 1864 times
4,31 1816 times
4,11 1791 times
2,37 1755 times
then I found all the 6 numbers in the past draw that = 120 and got a 4 Patten hit
| 7 |
9 |
14 |
18 |
35 |
37 |
120 |
| 9 |
16 |
17 |
23 |
25 |
30 |
120 |
| 5 |
13 |
14 |
24 |
29 |
35 |
120 |
| 9 |
12 |
16 |
18 |
29 |
36 |
120 |
| 2 |
3 |
21 |
26 |
27 |
41 |
120 |
and found I got a hit with 4 numbers patterns with 9,16,23,25
4 numbers found patten
9,16,24,25 17 times
6,22,23,24 17 times
9,16,23,25 17 times
7,15,23,28 16 times
vba code
Option Explicit
Option Base 1
Const MinA As Integer = 1
Const MaxF As Integer = 45
Sub List_Comb()
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, f As Integer
Dim n As Long
Application.ScreenUpdating = False
Cells.Delete
Cells(1, 1).Select
n = 0
For A = MinA To MaxF - 4
For B = A + 1 To MaxF - 3
For C = B + 1 To MaxF - 2
For D = C + 1 To MaxF - 1
For E = D + 1 To MaxF
For f = E + 1 To MaxF
If A + B + C + D + E + f = 120 Then
ActiveCell.Value = A & "," & B & "," & C & "," & D & "," & E & "," & f
ActiveCell.Offset(1, 0).Select
End If
Next f
Next E
Next D
Next C
Next B
Next A
Application.ScreenUpdating = True
End Sub