Help wanted with lottery software --

Hello all :) I was wondering if anyone more familiar with the different lottery softwares out there could help me out. I think what I am looking for is very basic, but somehow I am missing it.

Let me show you an example of what I am looking for. For a lottery where five numbers are chosen, let's say each number is represented by A, B, C, D, & E. Now I want to assign a few numbers to each letter group so that:

A= 1 or 2

B = 11 or 12,

C= 17, 20 or 22

D= 25, 26, or 28

E = 36 or 38


I am looking for a software program that can generate every combination available for separate groups of numbers. In this case, the five groups above would generate 72 tickets. So in this batch the first number generated on each ticket would only ever be a 1 or 2, the second number on each ticket would only ever be an 11 or 12, etc. Most programs seem to want to group all the numbers together and then generate tickets.

Plus, being able to then print the tickets within the same program would be a big help.

Does anyone know a lottery software that can do this?
 

GillesD

Member
Lottery software???

PacificBlue

If you have Excel, you have everything you need to generate the combinations you want.

The very simple macro listed below will list the combinations you want.

Option Explicit
Dim A As Integer, B As Integer, C As Integer
Dim D As Integer, E As Integer, I As Integer
Dim minA As Integer, maxA As Integer, minB As Integer, maxB As Integer
Dim minC As Integer, maxC As Integer, minD As Integer, maxD As Integer
Dim minE As Integer, maxE As Integer

Sub List_Comb()
Range("A1").Select
minA = ActiveCell.Offset(0, 0).Value
maxA = ActiveCell.Offset(0, 1).Value
minB = ActiveCell.Offset(0, 2).Value
maxB = ActiveCell.Offset(0, 3).Value
minC = ActiveCell.Offset(0, 4).Value
maxC = ActiveCell.Offset(0, 5).Value
minD = ActiveCell.Offset(0, 6).Value
maxD = ActiveCell.Offset(0, 7).Value
minE = ActiveCell.Offset(0, 8).Value
maxE = ActiveCell.Offset(0, 9).Value
I = 1
For A = minA To maxA
For B = minB To maxB
For C = minC To maxC
For D = minD To maxD
For E = minE To maxE
Select Case A
Case 1, 2
Select Case B
Case 11, 12
Select Case C
Case 17, 20, 22
Select Case D
Case 25, 26, 28
Select Case E
Case 36, 38
ActiveCell.Offset(I, 0).Value = I
ActiveCell.Offset(I, 1).Value = A
ActiveCell.Offset(I, 2).Value = B
ActiveCell.Offset(I, 3).Value = C
ActiveCell.Offset(I, 4).Value = D
ActiveCell.Offset(I, 5).Value = E
I = I + 1
End Select
End Select
End Select
End Select
End Select
Next E
Next D
Next C
Next B
Next A
End Sub

In the macro itself, for each line following a SELECT CASE statement, enter after the CASE word the values you want for each group. In your case after the SELECT CASE A, enter CASE 1, 2 since you want either a 1 or a 2 in group A.

Then enter in cells A1 to J1, the respective minimum and maximum values for groups A, B, C D and E (min A in A1, max A in B1, min B in C1, etc.).

Then run the macro and you have all combinations listed starting at line 2.

Obviously, this macro could be improved to list on a separate page the minimum and maximun values for each group as well as each individual values to be selected and then the combinations would be listed on another page.
 
Thank you!

GillesD, thank you for your help :) I suspected Excel might be able to do this, but I had no idea how to create a macro for it. Thank you for sharing your macro with me.
 

GillesD

Member
Macro for generating combinations

Thank you PacificBlue

I saw your request as a challenge and it started with a very basic macro but quickly grew more complicated. I may make it as general as possible as mentionned at the end of my post.
 

bloubul

Member
Help wanted with lottery software

Hi GillesD

Thanks for a great macro.
Will it not be possible for you to add some code to it that it can pick up the values from A1:J1, instead we as "ROOKIES" who got no idea of a macro to change the values in the macro and than run it again. We will for get the "Comma's and Spaces" in the select Case Statements.


Thanks in advance

BlouBul :cool:
 

GillesD

Member
Cominations from 5 groups

The macro listed below appears to provide what PacificBlue requested initially. It also alows flexibility in selecting up to 6 numbers in each of the 5 groups (A to E) with no need to modify the macro itself as bloubul asked.

A - Set-up:

On Sheet1, in cells A1 to E1, enter labels like Group A, Group B, Group C, Group D and Group E. Then from rows 2 to 7, enter under each label the values you want for that group. You need to have at least one and a maximum of 6 numbers in each group. Values should be listed in increasing order from row 2 to row 7 in a group. Leave cells blank at the bottom if you choose less than 6 numbers in a group. All numbers must be different.

On Sheet2, in cells A1 to E1, enter labels like #, N1, N2, N3, N4 and N5

B - Code for the macro:

Enter the following code in a module:

Option Explicit
Dim A As Integer, B As Integer, C As Integer
Dim D As Integer, E As Integer, I As Integer
Dim minA As Integer, maxA As Integer, minB As Integer, maxB As Integer
Dim minC As Integer, maxC As Integer, minD As Integer, maxD As Integer
Dim minE As Integer, maxE As Integer
Dim nA(6) As Integer, nB(6) As Integer, nC(6) As Integer
Dim nD(6) As Integer, nE(6) As Integer

Sub CombFromGroups()
Sheets("Sheet1").Select
Range("A1").Select
For I = 1 To 6
nA(I) = ActiveCell.Offset(I, 0).Value
nB(I) = ActiveCell.Offset(I, 1).Value
nC(I) = ActiveCell.Offset(I, 2).Value
nD(I) = ActiveCell.Offset(I, 3).Value
nE(I) = ActiveCell.Offset(I, 4).Value
Next I
minA = nA(1)
minB = nB(1)
minC = nC(1)
minD = nD(1)
minE = nE(1)
maxA = Application.WorksheetFunction.Max(nA(1), nA(2), nA(3), nA(4), nA(5), nA(6))
maxB = Application.WorksheetFunction.Max(nB(1), nB(2), nB(3), nB(4), nB(5), nB(6))
maxC = Application.WorksheetFunction.Max(nC(1), nC(2), nC(3), nC(4), nC(5), nC(6))
maxD = Application.WorksheetFunction.Max(nD(1), nD(2), nD(3), nD(4), nD(5), nD(6))
maxE = Application.WorksheetFunction.Max(nE(1), nE(2), nE(3), nE(4), nE(5), nE(6))
I = 1
Sheets("Sheet2").Select
Application.ScreenUpdating = False
Range("A2.F7777").Delete
Range("A1").Select
For A = minA To maxA
For B = minB To maxB
For C = minC To maxC
For D = minD To maxD
For E = minE To maxE
Select Case A
Case nA(1), nA(2), nA(3), nA(4), nA(5), nA(6)
Select Case B
Case nB(1), nB(2), nB(3), nB(4), nB(5), nB(6)
Select Case C
Case nC(1), nC(2), nC(3), nC(4), nC(5), nC(6)
Select Case D
Case nD(1), nD(2), nD(3), nD(4), nD(5), nD(6)
Select Case E
Case nE(1), nE(2), nE(3), nE(4), nE(5), nE(6)
ActiveCell.Offset(I, 0).Value = I
ActiveCell.Offset(I, 1).Value = A
ActiveCell.Offset(I, 2).Value = B
ActiveCell.Offset(I, 3).Value = C
ActiveCell.Offset(I, 4).Value = D
ActiveCell.Offset(I, 5).Value = E
I = I + 1
End Select
End Select
End Select
End Select
End Select
Next E
Next D
Next C
Next B
Next A
Application.ScreenUpdating = True
End Sub


After running the macro, you will have on Sheet2 all combinations from the numbers entered on Sheet1. It works from one number in each group (not very usefull, I agree) to 6 numbers in all groups (for 7,776 combinations).
 
PacificBlue said:
Hello all :) I was wondering if anyone more familiar with the different lottery softwares out there could help me out. I think what I am looking for is very basic, but somehow I am missing it.

Let me show you an example of what I am looking for. For a lottery where five numbers are chosen, let's say each number is represented by A, B, C, D, & E. Now I want to assign a few numbers to each letter group so that:

A= 1 or 2

B = 11 or 12,

C= 17, 20 or 22

D= 25, 26, or 28

E = 36 or 38


I am looking for a software program that can generate every combination available for separate groups of numbers. In this case, the five groups above would generate 72 tickets. So in this batch the first number generated on each ticket would only ever be a 1 or 2, the second number on each ticket would only ever be an 11 or 12, etc. Most programs seem to want to group all the numbers together and then generate tickets.

Plus, being able to then print the tickets within the same program would be a big help.

Does anyone know a lottery software that can do this?

PacificBlue, Lotto Architect (my program) can also do this very easily using the number groups system. If you want, perform a search here where another person requested a more complicated group feature, where I discuss what that system can do.

cheers
lottoarchitect
 

Sidebar

Top