Following are 4 different methods to generate random numbers in Excel
Table of Contents
RAND Function
The RAND function in Excel can be used to generate a random number between 0 and 1.
![](https://xlncad.com/wp-content/uploads/2022/03/Rand-Function_1.png)
The RAND function is a volatile function and will update every when the worksheet is recalculated.
![](https://xlncad.com/wp-content/uploads/2022/03/Rand-Function_2.gif)
RANDBETWEEN Function
The RANDBETWEEN function returns a random number between two specified values in it.
For example, the formula =RANDBETWEEN(10,75) will return a random number between 10 and 75.
![](https://xlncad.com/wp-content/uploads/2022/03/Rand-Function_3.png)
The RANDBETWEEN function also is a volatile function and will update every when the worksheet is recalculated.
![](https://xlncad.com/wp-content/uploads/2022/03/RandBetween-Function_4.gif)
RANDARRAY Function
The RANDARRAY function is of the new Dynamic Array Function which can return an array of random numbers.
The RANDARRAY function accepts 5 arguments which can used to specify the number of Rows, Columns, Number limits and type of number, whether Integer or Decimal.
=RANDARRAY(9,5,-15,50,TRUE) will return an array of 45 Integers between -15 and 50.
![](https://xlncad.com/wp-content/uploads/2022/03/Rand-Function_5.png)
For decimal numbers, use FALSE instead of TRUE.
![](https://xlncad.com/wp-content/uploads/2022/03/RandBetween-Function-7.gif)
Excel Macro to generate random number
The following VBA code when executed will generate a random number between 50 and 999, in the cell C3
Sub CreateRandomNumber() Range("C3").Value = Int((999 - 50 + 1) * Rnd + 50) End Sub
![](https://xlncad.com/wp-content/uploads/2022/03/RandBetween-Function-8.gif)