5 from 50 Number Generator.

sezuh

Well-known Member
Joined
Nov 19, 2010
Messages
708
hi,
would be possible to have number genarator to assign 10 columns with 5 numbers in each column,but with no 3 consecutive numbers to be assigned in any column at all.and also every time i run the code to give different numbers untill all 50 numbers been used.thank you in advane for any assistance.here an example:
Sheet1

<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD> </TD><TD>A</TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD><TD>H</TD><TD>I</TD><TD>J</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD>correct result</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD style="TEXT-ALIGN: right">1</TD><TD style="TEXT-ALIGN: right">2</TD><TD style="TEXT-ALIGN: right">3</TD><TD style="TEXT-ALIGN: right">4</TD><TD style="TEXT-ALIGN: right">5</TD><TD style="TEXT-ALIGN: right">6</TD><TD style="TEXT-ALIGN: right">7</TD><TD style="TEXT-ALIGN: right">8</TD><TD style="TEXT-ALIGN: right">9</TD><TD style="TEXT-ALIGN: right">10</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD style="TEXT-ALIGN: right">20</TD><TD style="TEXT-ALIGN: right">11</TD><TD style="TEXT-ALIGN: right">12</TD><TD style="TEXT-ALIGN: right">13</TD><TD style="TEXT-ALIGN: right">14</TD><TD style="TEXT-ALIGN: right">15</TD><TD style="TEXT-ALIGN: right">16</TD><TD style="TEXT-ALIGN: right">17</TD><TD style="TEXT-ALIGN: right">18</TD><TD style="TEXT-ALIGN: right">19</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD style="TEXT-ALIGN: right">30</TD><TD style="TEXT-ALIGN: right">29</TD><TD style="TEXT-ALIGN: right">28</TD><TD style="TEXT-ALIGN: right">27</TD><TD style="TEXT-ALIGN: right">26</TD><TD style="TEXT-ALIGN: right">25</TD><TD style="TEXT-ALIGN: right">24</TD><TD style="TEXT-ALIGN: right">23</TD><TD style="TEXT-ALIGN: right">22</TD><TD style="TEXT-ALIGN: right">21</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</TD><TD style="TEXT-ALIGN: right">35</TD><TD style="TEXT-ALIGN: right">36</TD><TD style="TEXT-ALIGN: right">31</TD><TD style="TEXT-ALIGN: right">32</TD><TD style="TEXT-ALIGN: right">33</TD><TD style="TEXT-ALIGN: right">34</TD><TD style="TEXT-ALIGN: right">38</TD><TD style="TEXT-ALIGN: right">37</TD><TD style="TEXT-ALIGN: right">40</TD><TD style="TEXT-ALIGN: right">39</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</TD><TD style="TEXT-ALIGN: right">42</TD><TD style="TEXT-ALIGN: right">43</TD><TD style="TEXT-ALIGN: right">44</TD><TD style="TEXT-ALIGN: right">45</TD><TD style="TEXT-ALIGN: right">41</TD><TD style="TEXT-ALIGN: right">50</TD><TD style="TEXT-ALIGN: right">48</TD><TD style="TEXT-ALIGN: right">49</TD><TD style="TEXT-ALIGN: right">47</TD><TD style="TEXT-ALIGN: right">46</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">7</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">8</TD><TD>not correct</TD><TD> </TD><TD> </TD><TD> </TD><TD>correct</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">9</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">1</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">25</TD><TD style="TEXT-ALIGN: right">6</TD><TD> </TD><TD style="TEXT-ALIGN: right">1</TD><TD style="TEXT-ALIGN: right">2</TD><TD style="TEXT-ALIGN: right">3</TD><TD>></TD><TD>></TD><TD>></TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">10</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">2</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">26</TD><TD style="TEXT-ALIGN: right">11</TD><TD> </TD><TD style="TEXT-ALIGN: right">11</TD><TD style="TEXT-ALIGN: right">20</TD><TD style="TEXT-ALIGN: right">29</TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">11</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">3</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">27</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">42</TD><TD> </TD><TD style="TEXT-ALIGN: right">28</TD><TD style="TEXT-ALIGN: right">31</TD><TD style="TEXT-ALIGN: right">30</TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">12</TD><TD style="TEXT-ALIGN: right">21</TD><TD style="TEXT-ALIGN: right">30</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">43</TD><TD> </TD><TD style="TEXT-ALIGN: right">32</TD><TD style="TEXT-ALIGN: right">33</TD><TD style="TEXT-ALIGN: right">34</TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">13</TD><TD style="TEXT-ALIGN: right">40</TD><TD style="TEXT-ALIGN: right">31</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">44</TD><TD> </TD><TD style="TEXT-ALIGN: right">41</TD><TD style="TEXT-ALIGN: right">45</TD><TD style="TEXT-ALIGN: right">48</TD><TD> </TD><TD> </TD><TD> </TD></TR></TBODY></TABLE>
sezuh
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

sezuh

Well-known Member
Joined
Nov 19, 2010
Messages
708
sorry i forgot to add:if the code to be run 49 times it would give a result of,every number would be paired with any other number 4 times exactly.
thanks
 

sezuh

Well-known Member
Joined
Nov 19, 2010
Messages
708

ADVERTISEMENT

any help please?
 

sezuh

Well-known Member
Joined
Nov 19, 2010
Messages
708

ADVERTISEMENT

Help.....:rolleyes:
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,833
Office Version
  1. 2010
Platform
  1. Windows
IMO, you would be better of posting in a math forum (e.g., Drexel's mathforum.org).
 

energman58

Well-known Member
Joined
Oct 25, 2010
Messages
553
This is a variant of the "dining club" problem which is mathematically very hard to solve plus you have added a bunch of other constraints in that you cant have 3 consecutive numbers in any column. I suspect that you may have posed a problem that is too hard to solve (if there is a solution)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,944
Messages
5,856,446
Members
431,814
Latest member
Oriel Tzvi Shaer

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
Top