toolrota

How to generate random numbers in Excel: RANDBETWEEN, RAND and RANDARRAY

We explain how to use Excel's random number functions to run a draw, create test data or shuffle a list.

Serkan Akyürek··3 min read
How to generate random numbers in Excel: RANDBETWEEN, RAND and RANDARRAY – Excel

When you want to run a draw, generate sample data for training or shuffle a list, Excel's random number functions do the job. RANDBETWEEN gives a whole number between two limits, RAND gives a decimal between 0 and 1, and RANDARRAY produces a set of random numbers with one formula. All of them change on every recalculation, so knowing how to freeze the result is important.

Comparing the functions

FunctionWhat it producesExample
RANDBETWEEN(bottom, top)Whole numberRANDBETWEEN(1,100)
RAND()Decimal between 0 and 1RAND()*50
RANDARRAY(rows, cols, min, max, whole)An array of random numbersRANDARRAY(10,1,1,6,TRUE)

RANDARRAY is available in Microsoft 365 and Excel 2021 and later.

Example uses

  • Draw: give each participant a random number and pick the smallest.
  • Dice simulation: RANDBETWEEN(1,6).
  • Test data: random amounts for trying out a sales table.
  • Random date: use RANDBETWEEN between two dates and format the cell as a date.
Shuffling a list
  1. 1

    Add a helper column next to the list

  2. 2

    Put a RAND formula in each row

  3. 3

    Copy the values and paste as values only

  4. 4

    Sort the list by the helper column

  5. 5

    Delete the helper column

In Microsoft 365 you can do the same in one formula with SORTBY and RANDARRAY. For sorting see our sort and filter guide.

Freezing the result

Random functions recalculate on every cell change and when you press F9. To keep a result, copy the area and paste with Paste Special, Values. For a single cell, press F9 in the formula bar and then Enter to turn the result into a fixed value.

Random picks without repeats

RANDBETWEEN can produce the same number more than once. For a pick without repeats, shuffle the list with the method above and take the first N rows. For duplicate checks see our remove duplicates guide.

Common mistakes

  1. Sharing without freezing the result. Values change when the file opens.
  2. Relying on RANDBETWEEN for picks without repeats.
  3. Leaving many random formulas in large tables. The file slows down.
  4. Not documenting the process for important draws. Record the steps for transparency.

Frequently asked questions

Is it truly random? Excel produces pseudo-random numbers; they're fine for everyday work but not for security or official draws.

How do I set the number of decimals? With the ROUND function; see our Excel rounding guide.

Summary

Excel's random number functions are handy for draws, sample data and shuffling. Don't forget to paste the result as values.

Share
Published:
Author
Serkan Akyürek

Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.