LOTTERY NUMBER GENERATOR – WITHOUT DUPLICATES

In the previous part we saw how we can generate 7 random numbers. The problem was that there could be duplicates.

As before we are going to use the RANDARRAY-function.

  • To generate random numbers from 1 to 50
  • RANDARRAY(150;1;1;50;TRUE)
  • 150 above is the pool of random numbers
  • We want numbers between 1 and 50
  • TRUE means only integers
  • Now we want only unique numbers
  • =UNIQUE(RANDARRAY(150;1;1;50;TRUE))
  • Now we need to fetch the numbers
  • We use INDEX for this, this extracts the first 7 values
  • This is specified by the SEQUENCE
  • SEQUENCE(1;7)
  • 1 row and 7 columns
  • Put together we get the below complete formula
  • =INDEX(UNIQUE(RANDARRAY(150;1;1;50;TRUE));SEQUENCE(1;7))

Discover more from Excel tutorials

Subscribe to get the latest posts sent to your email.

Leave a comment

I’m Henrik

Welcome to Excel tutorials made easy. This site is full of easy to follow tutorials