# Generate Random Numbers

1. ## Generate Random Numbers

Hey, I was wondering if there was a way to generate random numbers in a series of cells without repeating one another.

For example, Say I want A1-D1 to be populated randomly with 1-6, not repeating a number at all. So i'd have a sequence like 132654 or 452136.

Is that possible to do?

2. Do you mean A1:F1.

One way is to use this formula in A1

=INT(RAND()*6+1)

and then in B1 copied across to F1

=SMALL(IF(ISNA(MATCH({1,2,3,4,5,6},\$A1:A1,0)),{1,2,3,4,5,6}),INT(RAND()*(5-COLUMN()+COLUMN(\$B1))+1))

confirmed with CTRL+SHIFT+ENTER

3. The function below will enter a random sequence in whatever range it is entered. It must be entered as an array formula.

If you don't want the sequence to change every time the sheet calculates, comment out the Application.Volatile line.

``Please Login or Register  to view this content.``

4. Thank you both for the input, I should have mentioned that I don't want the numbers to change every time the sheet is calculated as that ends up being quite a few changes every time bogging down the system. As for the function, I saved it in the VBA editor but can't seem to call it up in the sheet itself. RandSeq(RANGE) is the proper format is it not?

5. If you don't want the numbers to change then one option is to download the free morefunc add-in and use MRAND function. This has a setting which fixes the random numbers

6. Originally Posted by Rgaherty
RandSeq(RANGE) is the proper format is it not?
No, just =RandSeq(), entered as a single array formula throuhghout the range in which you want the sequence to appear.
Originally Posted by daddylonglegs
If you don't want the numbers to change ...
As I said, if you don't want the numbers to change, change this
``Please Login or Register  to view this content.``
to
``Please Login or Register  to view this content.``
... or just delete the line.

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1