How to Generate Random Numbers in Excel?

How to generate random numbers in

You may need to generate random numbers for a variety of purposes. In this tutorial, we will learn how to generate random numbers in Excel.

There are two in-built functions in Excel to generate random numbers: RAND and RANDBETWEEN. Let’s look into how we can use these two functions.

Generate random numbers using RAND

RAND function returns a random real number greater than or equal to 0 and less than 1. A new random real number is returned every time the worksheet is calculated. The RAND function has no arguments. Syntax: RAND()

  • Select the cell in which you want to get the random number.
  • Type =RAND() and press Enter. 
RAND single
  • To generate a list of random numbers, select the cell with the formula, click on the lower right corner of the cell and drag it down to copy the formula.
RAND list

Here are some examples of RAND function implementation.

  • Using RAND function to generate random numbers greater than or equal to 0 and less than 100.
RAND list 0 100
  • Using RAND function to generate random whole numbers greater than or equal to 0 and less than 100.
rand list int 0 100
  • Using RAND function to generate random whole numbers between two specified numbers. Formula: =INT(RAND()*(b-a)+a), where a is the lower limit and b is the upper limit.
rand bwtween two numbers

Generate random numbers using RANDBETWEEN

RANDBETWEEN function returns a random integer number between two specified numbers. A new random integer number is returned every time the worksheet is calculated.

Syntax: RANDBETWEEN(bottom, top)

  • bottom: Required. The smallest integer RANDBETWEEN will return.
  • top: Required. The largest integer RANDBETWEEN will return.

Let’s use the RANDBETWEEN function to generate numbers within a range.

  • Select the cell in which you want to get the random number.
  • Type =RANDBETWEEN(1,50) and press Enter. 
RANDBETWEEN single number
  • To generate a list of random numbers, select the cell with the formula, click on the lower right corner of the cell and drag it down to copy the formula.
RANDBETWEEN number list

NOTE: The random numbers generated by RAND and RANDBETWEEN change every time the worksheet is calculated. To avoid this, simply copy the random numbers and paste them as values.

Conclusion

Generating random numbers can be time-consuming if one has to do it manually. In this article, we learned how to quickly generate random numbers using two in-built functions RAND and RANDBETWEEN in Excel.