Select a random number from a list then remove, rinse, repeat

tezza

Active Member
Joined
Sep 10, 2006
Messages
384
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
  2. Web
Hi all,

Ok, I'll try to explain what I need.

I have a number list 1 - 90

The numbers are split in 9 groups

I need to randomly pick 5 groups then randomly pick 1 number from each of the groups,
Show the numbers picked
remove the picked numbers from the original list

After the first round of picks the list of numbers reduce by five

With the remaining numbers I need to repeat the process - choose 5 random numbers from 5 random groups and remove from list

Rinse and repeat until there are no numbers left

When all the numbers in a group have been used then that group needs to be eliminated.

Bingo.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCACBCCCDCECFCGCHCICJCKCLCMCNCOCPCQCR
1Random No:GroupGroupGroupGroupGroupGroupGroupGroupGroup
212345123456789
311344068711234567910121314151617181920222324252627282930313233353637384142434446474950515253545658596061636465666769707273747576777879818283848687888990
48214855801234567910121314151617181920222324252627282930313233353637384142434446474950515253545658596061636465666769707273747576777879818283848687888990
539455762851234567910121314151617181920222324252627282930313233353637384142434446474950515253545658596061636465666769707273747576777879818283848687888990
Sheet1
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
It would be easier if grouping like this is possible:
1-10, 11-20, 21-30, 31-40, 41-50, 51-60, 61-70, 71-80, 81-90

Will it be a big deal?
 
Upvote 0
It would be easier if grouping like this is possible:
1-10, 11-20, 21-30, 31-40, 41-50, 51-60, 61-70, 71-80, 81-90

Will it be a big deal?
Hi, no it has to be like in my example otherwise it won't work.
 
Upvote 0
If it helps, I only need to see the five numbers randomly chosen, the rest is just a visual for posting on here.
 
Upvote 0
otherwise it won't work.
a. Why not? What is the logic/theory behind that assertion?

b. It mostly won't work anyway. If the choices are truly random, it is quite likely that when you get down to the last 5 numbers (or even before that) the remaining numbers will be in 4 or less groups so it is then not possible to choose a number from 5 different groups.
 
Upvote 0
a. Why not? What is the logic/theory behind that assertion?

b. It mostly won't work anyway. If the choices are truly random, it is quite likely that when you get down to the last 5 numbers (or even before that) the remaining numbers will be in 4 or less groups so it is then not possible to choose a number from 5 different groups.
No, if done right then the last group of 5 random numbers will be in 5 different groups which will then finish the search.

It reduces by 5 numbers EVERY time from 5 different group. If say group one is empty then it needs to look in a different group that contains at least one number.

This is what I'm after (the grid on the right), or the first three lines of it at least.

The left grid is just a visual for here.

So, 5 random numbers from 5 random groups (1-9), if a group is empty then move a one that isn't.

Hope that helps explain it a little better.

numbers 2.png
 
Upvote 0
Bad example sorry, there's meant to be 5 numbers in a row, not 4 like in row 3 (rushed it)
 
Upvote 0
I don't think that you are fully understanding random choices.
If the 5 groups are chosen at random then it is possible that for the first 10 passes, groups 2,4,5,7 & 8 could be chosen every time. That would leave those groups empty and the remaining groups would be groups 1, 3, 6 and 9. That is, 4 groups only.

Whilst the above is an extremely remote possibility, the concept is real. Here is an example where I have actually done what you requested. I started with numbers 1 to 90 in G14:CR14, chose 5 random groups, chose a random number out of each of the 5 groups and removed them. Repeated the process and this is where I ended. How can I now choose 5 different groups for my next turn?

tezza.xlsm
GHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCACBCCCDCECFCGCHCICJCKCLCMCNCOCPCQCR
12GroupGroupGroupGroupGroupGroupGroupGroupGroup
13123456789
14114478087
90
 
Upvote 0
I don't think that you are fully understanding random choices.
If the 5 groups are chosen at random then it is possible that for the first 10 passes, groups 2,4,5,7 & 8 could be chosen every time. That would leave those groups empty and the remaining groups would be groups 1, 3, 6 and 9. That is, 4 groups only.

Whilst the above is an extremely remote possibility, the concept is real. Here is an example where I have actually done what you requested. I started with numbers 1 to 90 in G14:CR14, chose 5 random groups, chose a random number out of each of the 5 groups and removed them. Repeated the process and this is where I ended. How can I now choose 5 different groups for my next turn?

tezza.xlsm
GHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAYAZBABBBCBDBEBFBGBHBIBJBKBLBMBNBOBPBQBRBSBTBUBVBWBXBYBZCACBCCCDCECFCGCHCICJCKCLCMCNCOCPCQCR
12GroupGroupGroupGroupGroupGroupGroupGroupGroup
13123456789
14114478087
90
You have two numbers from group 9, where there should only be one

Think of it like making a rand() list of 9 numbers then rank them in order and choose the first five numbers

That will be your five groups (the problem is when the group is empty so you either have to run it again or tell it to ignore the empty group)

Once you have your 5 groups then pick a random number within the group.
 
Upvote 0
Here's an example of what should be left after each line only allowing 5 numbers

The last group of 5 numbers will slot into the rows where the count is only 4.

Now I just need to automate it (again, only the right grid is visually needed but if the left grid is needed to make it work then I can simply hide it)

numbers 3.png
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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