S.H.A.D.O.
Well-known Member
- Joined
- Sep 6, 2005
- Messages
- 1,915
Good afternoon,
I am trying to work out how many sets of numbers appear in total when looping through all combinations.
There are 10 sets, comprising of...
01 & 10 / 02 & 20 / 03 & 30 / 04 & 40 / 12 & 21 /
13 & 31 / 14 & 41 / 23 & 32 / 24 & 42 / 34 & 43
...what I would like to know is how many of the sets in total appear in...
0 sets, this means that NO combinations contain ANY of the 10 sets.
1 sets, this means that ONLY 1 of ANY of the 10 sets appears in ANY combination.
2 sets, this means that ONLY 2 of ANY of the 10 sets appears in ANY combination.
3 sets, this means that ONLY 3 of ANY of the 10 sets appears in ANY combination.
I have tried using case statements but I couldn't seem to get that to work, I have tried grouping the sets, but to no avail either.
Here is some code that loops through all the combinations, it is obtaining the data above that I am stuck on.
I hope this makes sense.
Thanks in advance.
I am trying to work out how many sets of numbers appear in total when looping through all combinations.
There are 10 sets, comprising of...
01 & 10 / 02 & 20 / 03 & 30 / 04 & 40 / 12 & 21 /
13 & 31 / 14 & 41 / 23 & 32 / 24 & 42 / 34 & 43
...what I would like to know is how many of the sets in total appear in...
0 sets, this means that NO combinations contain ANY of the 10 sets.
1 sets, this means that ONLY 1 of ANY of the 10 sets appears in ANY combination.
2 sets, this means that ONLY 2 of ANY of the 10 sets appears in ANY combination.
3 sets, this means that ONLY 3 of ANY of the 10 sets appears in ANY combination.
I have tried using case statements but I couldn't seem to get that to work, I have tried grouping the sets, but to no avail either.
Here is some code that loops through all the combinations, it is obtaining the data above that I am stuck on.
Code:
Option Explicit
Option Base 1
Const MinA As Integer = 1
Const MaxF As Integer = 49
Sub Sum_Total_Groups()
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim n As Integer
Dim nType(1 To 4) As Double
Dim Total As Long
Dim Map(1 To 4) As Double
Cells(1, 1).Select
For A = MinA To MaxF - 5
For B = A + 1 To MaxF - 4
For C = B + 1 To MaxF - 3
For D = C + 1 To MaxF - 2
For E = D + 1 To MaxF - 1
For F = E + 1 To MaxF
' Maybe code goes here?
Next F
Next E
Next D
Next C
Next B
Next A
For n = LBound(nType) To UBound(nType)
Total = Total + nType(n)
ActiveCell.Offset(n - LBound(nType), 0).Value = Map(n)
ActiveCell.Offset(n - LBound(nType), 1).Value = nType(n)
Next n
ActiveCell.Offset(n - LBound(nType), 1).Value = Total
End Sub
I hope this makes sense.
Thanks in advance.