Number Combination Calculator Help Please

binar

Member
Fellow forum Members,
My goal is to combine a series of numbers such as 2,4,5,8,1,6,34,13,15 into all possible combinations. I want to have the ability to input whatever series of numbers I want and then have a list generated that will show all of the possible combinations as 2 columned number sets or 3 columned number sets or 4 columned number sets. What I need is a number combination calculator. Apps like Lotto Pro don't have this capability. I have also tried Ininuga and Expert Lotto and these apps also can't deliver with this task. Can anyone out there let me know where I can get my hands on a Number Combination Calculator. Thanks for any help.
 

GillesD

Member
2 - 3 - 4 number combinations

Binar

I am not sure this is exactly what you want but the following macro in Excel will generate all combinations with 2, 3 and 4 numbers out of a maximum of 20 numbers.

First in cells A1 to D1, enter titles such as Numbers, Pairs, Triples and Quads.
Then in cells A2 to A21, enter the numbers you want combined; enter up to 20 numbers in any order you want.

Then run the following macro and you will get 2, 3 and 4 number combinations respectively in columns B, C and D (format as you may want after):

Option Explicit

Dim Nb As Integer, NbRange As Range
Dim A As Integer, B As Integer, C As Integer, D As Integer
Dim I As Integer, J As Integer, sTxt(4845) As String

Sub Do_PTQ()
' Display all possible pairs, triples and quads
' based on a maximum of numbers
' Show Pairs
Set NbRange = Range("A2:A21")
Nb = Application.WorksheetFunction.CountA(NbRange)
Range("A1").Select
I = 1
For A = 1 To Nb - 1
For B = A + 1 To Nb
sTxt(I) = ActiveCell.Offset(A, 0).Value & "--" & ActiveCell.Offset(B, 0).Value
I = I + 1
Next B
Next A
For J = 1 To I - 1
ActiveCell.Offset(J, 1).Value = sTxt(J)
Next J
' Show Triples
I = 1
For A = 1 To Nb - 2
For B = A + 1 To Nb - 1
For C = B + 1 To Nb
sTxt(I) = ActiveCell.Offset(A, 0).Value & "--" & ActiveCell.Offset(B, 0).Value _
& "--" & ActiveCell.Offset(C, 0).Value
I = I + 1
Next C
Next B
Next A
For J = 1 To I - 1
ActiveCell.Offset(J, 2).Value = sTxt(J)
Next J
' Show Quads
I = 1
For A = 1 To Nb - 3
For B = A + 1 To Nb - 2
For C = B + 1 To Nb - 1
For D = C + 1 To Nb
sTxt(I) = ActiveCell.Offset(A, 0).Value & "--" & ActiveCell.Offset(B, 0).Value _
& "--" & ActiveCell.Offset(C, 0).Value & "--" & ActiveCell.Offset(D, 0).Value
I = I + 1
Next D
Next C
Next B
Next A
For J = 1 To I - 1
ActiveCell.Offset(J, 3).Value = sTxt(J)
Next J
End Sub
 
Hello GillesD!

Your macro really does a good job but it lacks perfection. What I find on a try is the total combin doesn't tally with all the possible combinations:
It gives pairs of 171 instead 190
It gives triples 969 instead 1140 and
It give quads of 3876 instead 4845.

I'll try to fix the bug and post it! but not immediately.
LM649:)
 

GillesD

Member
2, 3 or 4 number combinations

lottomaniac649

No I have not made a perfect macro and you can do whatever you want with my macro but as a start, I would try putting in 20 numbers in the range A2-A21. Oddly enough, the numbers you got (171 pairs, 969 triples and 3876 quads) are exactly what I get when I make combinations out of 19, not 20 numbers.

Maybe if you do this type of error in your calculations, it may be the reason why you get such good results in predicting winning numbers.

Cheer up, it still a fun game trying to develop a winning strategy for a lottery, although I do not believe it is feasible. The only proven theory is that as you bet more, your chances improve. But even in a head/tail flip, betting $1 for a head and $1 for a tail, you could still get a return of $0.00 if the coin lands and stays on its edge (not very often I agree but it can happen).
 
Hello GillesD!

I'm really sorry. After posting my comment I rechecked. Yes. There are only 20 rows filled in Column'A". The macro is right. This is a pure oversight which happen when we deal with all numbers all day along.

Thanks for your compliments that my errpr-prone calculations fetch good results in my predictions. As the work-load is getting heavy, I'm working on a 8 week single shot predictions from next month onwards. Here, the missed-outs in a draw will pop-up in another draw. Yesterday only I've done this analysis for my favourite one SIKKIM SUPER LOTTO. It comes oddly 15 HOt numbers. Let us see next month!
Thanks for your posting & Best Regards.
LM649:)
 

Sidebar

Top