# Non repeating random number is set of 6 numbers

Posted by Gareth Hall on December 18, 2001 2:46 AM

Started playing around at work today with a lotto coupon generating program, got a little stuckj when it started repeating numbers in the same game, here is what I have so far. The game draws 6 numbers from a barrel o45 and then 1 number from a different barrel of 45, not important for my program but at least you know.

From the site

http://www.goldencasket.com/powerball/number_frequencies.asp

From A1 to A16 are the numbers 1 to 16, from B1 to B16 are the 16 most frequent numbers sorted in numerical order, in cells D1 to I16 I have the formula =RANDBETWEEN($A$1,$A$16) which picks a number between 1 and 16 and puts it in the cell, in cell K1 I have the formula =VLOOKUP(D1,$A$1:$B$16,2,TRUE)which associates the number from 1 to 16 with the actual game number I want to use. I then paste that across another 5 columns to give me 6 numbers to go on my coupon, trouble is sometimes there is a double in the 6 numbers and I obviously can't fill the coupon in like this, I have tried and If statement but just keep getting circular reference errors. I know I am probably doing this the long way and could probably be made a lot simpler, any help with just not getting repeating numbers would be appreciated.