Pick a Winner

Can’t decide which lottery numbers to play? Have no fear, Excel is here.

RANDBETWEEN is a function that will return a random number between two numbers that you specify. But it only returns one number. And using multiple RANDBETWEEN functions doesn’t guarantee that there won’t be repeats. That’s no way to win the lottery. To do it properly, you need a few steps.

For brevity, the below example demonstrates how to randomly select three numbers between 1 and 10. First, start with a list of all possible numbers in column A. In column B, insert the RAND function and copy it down so that every number has a random number next to it.


Now, sort columns A and B on column B.


Simply read (or copy) the first three numbers and there you go.


If you do win the lottery using this method, send me an email and I’ll let you know where to mail my check.

3 thoughts on “Pick a Winner

  1. Cute – hope you get rich!

    It may confuse the Excel novices though, since rand() gives a new number on recalculation, which sorting provokes. So, people may wonder why the list in the third screenshot doesn’t appear to be sorted.

  2. Okay, so not an Excel feature, but if you open up a blank word document and type in “=rand(200,99)”, it spits out 225 pages of “The quick brown fox jumps over the lazy dog.”.

    Not really one I use everyday, but hey, it’s good to share…

  3. Of course you’re right Bill. That can be confusing and I should have mentioned it. Thanks.

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.