Needing help with formulas

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,
Ball 1 is in cell A1 - Ball 5 is in cell E1 and the Mega Ball is in cell F1


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: xl68, width: 64"]Ball 1[/TD]
[TD="class: xl68, width: 64"]Ball 2[/TD]
[TD="class: xl68, width: 64"]Ball 3[/TD]
[TD="class: xl68, width: 64"]Ball 4[/TD]
[TD="class: xl68, width: 64"]Ball 5[/TD]
[TD="class: xl69, width: 64"]MegaBall[/TD]
[/TR]
[TR]
[TD="class: xl73"]04[/TD]
[TD="class: xl73"]05[/TD]
[TD="class: xl73"]33[/TD]
[TD="class: xl73"]45[/TD]
[TD="class: xl65"]55[/TD]
[TD="class: xl70"]01[/TD]
[/TR]
[TR]
[TD="class: xl74"]09[/TD]
[TD="class: xl74"]11[/TD]
[TD="class: xl74"]42[/TD]
[TD="class: xl74"]47[/TD]
[TD="class: xl66"]62[/TD]
[TD="class: xl71"]05[/TD]
[/TR]
[TR]
[TD="class: xl66"]13[/TD]
[TD="class: xl66"]17[/TD]
[TD="class: xl66"]47[/TD]
[TD="class: xl66"]57[/TD]
[TD="class: xl66"]66[/TD]
[TD="class: xl71"]11[/TD]
[/TR]
[TR]
[TD="class: xl66"]0[/TD]
[TD="class: xl66"]21[/TD]
[TD="class: xl66"]0[/TD]
[TD="class: xl66"]0[/TD]
[TD="class: xl66"]71[/TD]
[TD="class: xl71"]0[/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="class: xl71"]0[/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="class: xl71"]0[/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="class: xl71"]0[/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="class: xl71"]0[/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="class: xl72"]0[/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]
[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]
[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]
[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]
[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]
[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]
[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]
[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]
[TR]
[TD="class: xl67"]0[/TD]
[TD="class: xl67"]0[/TD]
[TD="class: xl67"]0[/TD]
[TD="class: xl67"]0[/TD]
[TD="class: xl67"]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 ascending order which it does. But I'm having 2 problems with it,
1st. as you can see from the generated numbers shown below it 04,05,42,57,71,11 to 04,05,47,45,55,01
when it should be 04,05,47,57,62,01. The number 47 under ball 3 loops back to the 1st number under
ball 4 which is 45 when it should go to 57 which is higher than 47 under Ball 3.

[TABLE="width: 198"]
<colgroup><col><col span="3"><col><col></colgroup><tbody>[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]42[/TD]
[TD]57[/TD]
[TD]71[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]45[/TD]
[TD]55[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]45[/TD]
[TD]55[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]45[/TD]
[TD]55[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]45[/TD]
[TD]62[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[T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]62[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]66[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]66[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]66[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]71[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]71[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]47[/TD]
[TD]71[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]55[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]55[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]55[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]62[/TD]
[TD]01[/TD]
[/TR]
</tbody>[/TABLE]

2nd. as you can see from the generated numbers shown below it loops back to the beginning and starts
generating the numbers all over again, I just wanted to generate it 1 time.





[TABLE="width: 198"]
<colgroup><col><col span="3"><col><col></colgroup><tbody>[TR]
[TD]13[/TD]
[TD]21[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]66[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]21[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]66[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]21[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]66[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]21[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]71[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]21[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]71[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]21[/TD]
[TD]47[/TD]
[TD]57[/TD]
[TD]71[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]33[/TD]
[TD]45[/TD]
[TD]55[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]33[/TD]
[TD]45[/TD]
[TD]55[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]33[/TD]
[TD]45[/TD]
[TD]55[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]33[/TD]
[TD]45[/TD]
[TD]62[/TD]
[TD]01[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]33[/TD]
[TD]45[/TD]
[TD]62[/TD]
[TD]05[/TD]
[/TR]
[TR]
[TD]04[/TD]
[TD]05[/TD]
[TD]33[/TD]
[TD]45[/TD]
[TD]62[/TD]
[TD]11[/TD]
[/TR]
</tbody>[/TABLE]

can someone help me with these 2 problems

B1 in cells Q2-Q10001, B2 in cells R2-R10001, B3 in cells S2-S10001, B4 in cells T2-T10001, B5 in cells U2-U10001, and MB in cells V2-V10001


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)


Q3 =INDEX(Sheet1!$H$19:$H$26,'Lottery Generator'!W3+1)
R3 =INDEX(Sheet1!$J$19:$J$26,'Lottery Generator'!X3+1)
S3 =INDEX(Sheet1!$L$19:$L$26,'Lottery Generator'!Y3+1)
T3 =INDEX(Sheet1!$N$19:$N$26,'Lottery Generator'!Z3+1)
U3 =INDEX(Sheet1!$P$19:$P$26,'Lottery Generator'!AA3+1)
V3 =INDEX(Sheet1!$R$19:$R$26,'Lottery Generator'!AB3+1)


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

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,246
Messages
6,170,996
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