MrExcel's Learn Excel #734 - Bingo No Duplicates

If you like this content, please consider visiting the video on YouTube and subscribe to the MrExcel Channel to show your support!
This video has been published on Feb 12, 2009.
If you want to randomly choose from a list and never have duplicates, you can use the method discussed in this podcast. Episode 734 shows you how.

This blog is the video podcast companion to the book, Learn Excel 97-2007 from MrExcel. Download a new two minute video every workday to learn one of the 377 tips from the book!
maxresdefault.jpg


Transcript of the video:
Hey welcome back to the MrExcel netcast. I'm Bill Jelen.
Yesterday we talked about Hamilton's problem of generating bingo numbers.
And I said you know the big problem with just randomly generating 1 to 90 every time is you're going to have duplicates and my general approach when I want to get rid of the duplicates is to fill in the numbers, where that I want to draw from so for example, Cells 1 to 90 and so here in column E , I have all the possible bingo numbers 1 to 90 and in column F, I just have a series of RAND functions. RAND functions.
Basically what I'm going to do is sort by column F and whichever number either comes first or last is the number that we would choose.
In this case I'm going to take the last number so in theory would take that 8 that's down there in cell E91 and copy that up to cell A2 and now we could just delete that from the list to the next time that we draw, we would be basically sorting the remaining numbers.
And so to go back to Hamilton's question of how to do this. It's a couple of short little macros, not as short as yesterday, but let's kind of run through what happens in.
Start over first of all I clear all the cells and then build my headings in E1 and F1.
the headings for a number and sort.
Put in the number 1 and E2 and then use the data series command to fill in E2:E91 that gets me all the numbers from 1 to 90 and then an F-2:F91.
Put in my formula =RAND And now basically every time we calculate we're going to get new random numbers.
So the action of drawing is pretty simple.
We just choose cell F1 and sort the entire region by cell F1 saying that we have headers.
Down here. We then go to somewhere way below our data in this case. E100 is simple.
Hit the end key and the up arrow key and that will get us through the last number in the series and it's going to be a random number every time.
so I copy that and move it over to column A using the same technique we used yesterday.
And then finally delete the last values that we happen to have.
So every time we're going to get a new random number Let's try it.
Draw 70 is the first number chosen and then 21 and then 76 and then 82.
And what you can't see because it's down below the end of the screen, is that every time we draw, we are losing a few numbers off the end.
If we would go ahead and run this 90 times and actually will cut this out. We'll come back.
Okay, there we go.
We just randed. A whole bunch of time you see that every time that we choose a new random number, it's taking the number off the bottom and we're getting a shorter and shorter list down to the point, where we only have one ball left in the bingo cage by now someone should have called bingo, and ofcourse for the next game we would just start over.
So there you have it. A pretty easy way to do bingo numbers making sure that you get no duplicate numbers as you draw.
Well, thanks for stopping by. Will see you next time for another netcast from MrExcel.
 

Forum statistics

Threads
1,224,946
Messages
6,181,938
Members
453,074
Latest member
JefersonKollet

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