Having problems with my Lottery Generator Please Help!

studfin

New Member
Joined
Jan 5, 2014
Messages
30
I've made a Lottery Generator for Mega Millions and the lottery numbers are generated in a unique way,
the chart that I'm using looks like this:

[TABLE="width: 384"]
<colgroup><col width="64" span="6" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl67, width: 64"]Ball 1[/TD]
[TD="class: xl67, width: 64"]Ball 2[/TD]
[TD="class: xl67, width: 64"]Ball 3[/TD]
[TD="class: xl67, width: 64"]Ball 4[/TD]
[TD="class: xl67, width: 64"]Ball 5[/TD]
[TD="class: xl68, width: 64"]MegaBall[/TD]
[/TR]
[TR]
[TD="class: xl72"]01[/TD]
[TD="class: xl72"]02[/TD]
[TD="class: xl72"]11[/TD]
[TD="class: xl72"]40[/TD]
[TD="class: xl64"]47[/TD]
[TD="class: xl69"]01[/TD]
[/TR]
[TR]
[TD="class: xl73"]02[/TD]
[TD="class: xl73"]11[/TD]
[TD="class: xl73"]12[/TD]
[TD="class: xl73"]47[/TD]
[TD="class: xl65"]63[/TD]
[TD="class: xl70"]02[/TD]
[/TR]
[TR]
[TD="class: xl65"]03[/TD]
[TD="class: xl65"]12[/TD]
[TD="class: xl65"]35[/TD]
[TD="class: xl65"]52[/TD]
[TD="class: xl65"]72[/TD]
[TD="class: xl70"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl70"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl70"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl70"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl70"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl70"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl71"]0[/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD="class: xl65"]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl66"]0[/TD]
[TD="class: xl66"]0[/TD]
[TD="class: xl66"]0[/TD]
[TD="class: xl66"]0[/TD]
[TD="class: xl66"]0[/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]


I pick a array of numbers to be put under each Ball number (Ball 1 - Ball 5 + Mega Ball), and then have
it generated under each ball number in (Permutation) ascending order which it does. But I'm having 3 problems with it.


1st. as you can see from the generated numbers shown below in red it has repeats within the same lines of the combination.

[TABLE="width: 198"]
<colgroup><col><col span="3"><col><col></colgroup><tbody>[TR]
[TD]01[/TD]
[TD]02[/TD]
[TD]35[/TD]
[TD]52[/TD]
[TD]72[/TD]
[TD]02[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]47[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]47[/TD]
[TD]02[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]63[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]63[/TD]
[TD]02[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]72[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]72[/TD]
[TD]02[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]02[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]11[/TD]
[TD]11[/TD]
[TD]47[/TD]
[TD]63[/TD]
[TD]01[/TD]
[/TR]
</tbody>[/TABLE]

2nd. The number 03 under ball 1 loops back to the 1st number under ball 2 which is 02 when it should go to the next
higher 11 under ball 2.

[TABLE="width: 198"]
<colgroup><col><col span="3"><col><col></colgroup><tbody>[TR]
[TD]02[/TD]
[TD]12[/TD]
[TD]35[/TD]
[TD]52[/TD]
[TD]72[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]02[/TD]
[TD]12[/TD]
[TD]35[/TD]
[TD]52[/TD]
[TD]72[/TD]
[TD]02[/TD]
[/TR]
[TR]
[TD]03[/TD]
[TD]02[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]47[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]03[/TD]
[TD]02[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]47[/TD]
[TD]02[/TD]
[/TR]
</tbody>[/TABLE]





[TABLE="width: 198"]
<tbody>[TR]
[TD="class: xl69, width: 33"]03[/TD]
[TD="class: xl70, width: 33"]11[/TD]
[TD="class: xl70, width: 33"]12[/TD]
[TD="class: xl70, width: 33"]40[/TD]
[TD="class: xl71, width: 33"]47[/TD]
[TD="class: xl72, width: 33"]01[/TD]
[/TR]
</tbody>[/TABLE]

3rd. starts generating the combinations multiple times and won't stop until it reaches row 20001, I just
wanted it to generate it 1 time.

[TABLE="width: 198"]
<colgroup><col><col span="3"><col><col></colgroup><tbody>[TR]
[TD]03[/TD]
[TD]12[/TD]
[TD]35[/TD]
[TD]52[/TD]
[TD]72[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]03[/TD]
[TD]12[/TD]
[TD]35[/TD]
[TD]52[/TD]
[TD]72[/TD]
[TD]02[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]02[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]47[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]01[/TD]
[TD]02[/TD]
[TD]11[/TD]
[TD]40[/TD]
[TD]47[/TD]
[TD]02[/TD]
[/TR]
</tbody>[/TABLE]

can someone help me with these 3 problems


Formulae that I'm using:


W2:AB2 are hard coded =0


W3 =IF(SUM(X3:AB3)=0,MOD(W2+1,Sheet1!$H$18),W2)
X3 =IF(SUM(Y3:AB3)=0,MOD(X2+1,Sheet1!$J$18),X2)
Y3 =IF(SUM(Z3:AB3)=0,MOD(Y2+1,Sheet1!$L$18),Y2)
Z3 =IF(SUM(AA3:AB3)=0,MOD(Z2+1,Sheet1!$N$18),Z2)
AA3 =IF(SUM(AB3)=0,MOD(AA2+1,Sheet1!$P$18),AA2)
AB3 =MOD(AB2+1,Sheet1!$R$18)


Q2 =INDEX(Sheet1!$H$19:$H$26,'Lottery Generator'!W2+1)
R2 =INDEX(Sheet1!$J$19:$J$26,'Lottery Generator'!X2+1)
S2 =INDEX(Sheet1!$L$19:$L$26,'Lottery Generator'!Y2+1)
T2 =INDEX(Sheet1!$N$19:$N$26,'Lottery Generator'!Z2+1)
U2 =INDEX(Sheet1!$P$19:$P$26,'Lottery Generator'!AA2+1)
V2 =INDEX(Sheet1!$R$19:$R$26,'Lottery Generator'!AB2+1)


And I Fill from row 3 down as TO row 20001 as Total shows on 'Lottery Generator' Sheet
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top