If ... Then Loop
was Told . . .
Your acting like you have never asked for anthing like this before?
Produces:
13983816
0 Matches (no bonus): 6096454
1 Matches (no bonus): 5775588
2 Matches (no bonus): 1851150
3 Matches (no bonus): 246820
4 Matches (no bonus): 13545
5 Matches (no bonus): 252
6 Matches (With bonus): 6
6 Matches (no bonus): 1
At least 3 matches 260624
--
Regards,
Tom Ogilvy
"Paul Black" wrote in message
ups.com...
I Don't know if this Helps with the Overall Explanation or Not.
I was Told for the Interpretation of the 3 if 5 Category that you Need
to Cycle through ALL 5 Number Combinations that can be Constructed from
the Total Numbers Used in the Wheel ( 24 in this Case ). So if the
Wheel Contains "x" Unique Numbers, you Need to Cycle through ALL 5
Number Combinations from those "x" Numbers. Then you Need to Scan the
Wheel for Each 5 Number Combination Produced and Compare it with Each
Line in the Wheel to see if that Line Matches the 5 Number Combination
in *EXACTLY* 3 Numbers. If it does, then that Combination of 3 if 5 is
Covered and Added to the Total and there is NO Need to Continue to
Check for that Particular Combination Any Further. You then go onto the
Next Combination to Check and so on Until ALL Combinations have been
Cycled through and Checked with the Wheel.
Thanks in Advance.
All the Best.
Paul
Paul Black wrote:
Hello Everybody,
I am Basically trying to Find Out the Combinations Covered in a List of
Combinations.
I have a Set of 6 Number Combinations in Cells "G13:L27" ( the Number
of Combinations could be More or Less ).
In this Example I am Using a Wheel with 24 Numbers :-
1,3,7,12,15,16
1,4,5,17,20,21
1,8,9,10,19,22
1,13,14,18,23,24
2,3,6,9,21,23
2,10,12,14,16,20
2,11,15,19,20,24
3,4,7,10,18,24
3,5,7,14,17,19
4,6,8,14,15,22
4,9,11,13,16,19
5,10,13,15,17,23
5,11,12,18,21,22
6,8,12,16,17,24
7,8,13,20,22,23
Here is the Code Somebody Kindly Provided which Cycles through ALL
Combinations ( 6 Numbers from 24 Numbers in this Case Produces 134,596
Combinations ) and Compares ALL the Combinations with ALL the
Combinations in the Above Wheel. The Below Code Finds the Coverage of 5
Numbers if 5 Numbers Matched ...
Sub test_5()
Dim a, dic As Object
Set dic = CreateObject("Scripting.Dictionary")
a = Range("g13").CurrentRegion.Value
For i = 1 To UBound(a, 1)
For ii = 1 To 2
For iii = ii + 1 To 3
For iv = iii + 1 To 4
For v = iv + 1 To 5
For vi = v + 1 To 6
z = a(i, ii) & "," & a(i, iii) & a(i, iv) &
a(i, v) & a(i, vi)
If Not dic.exists(z) Then
dic.Add z, Nothing
n = n + 1
End If
Next vi, v, iv, iii, ii, i
Set dic = Nothing
Range("O16") = n
End Sub
... and Produces the Correct Result of 90.
How can the Code be Modified ( Or Improved ) to Also Produce the
Combinations Covered for the Categories ...
Matched Covered
2 if 5 = 42,504
3 if 5 = 35,720
4 if 5 = 4,140
5 if 5 = 90 ( the Code Already Provides this Result )
... Please.
I Hope I have Explained this Clear Enough.
Many Thanks in Advance.
All the Best.
Paul
|