Excel RAND & RANDBETWEEN function

The Excel RAND function returns a random number between 0 and 1. For example, =RAND() will generate a number like 0.422245717. RAND recalculates when a worksheet is opened or changed.

Purpose: 
Get a random number between 0 and 1

Return value: 
A number between 0 and 1

Syntax: 
=RAND()

=RANDBETWEEN(number1, number2)
Returns a random number between number1 and Number2

Very important:
RAND function takes no arguments:
=RAND() // returns number like 0.073979356
=RAND() // returns number like 0.080313118

Automatic recalculation:
The RAND function will calculate a new result each time a worksheet is edited. To stop random numbers from being updated, copy the cells that contain RAND to the clipboard, then use Paste Special > Values to convert to a static result.  
To get a single random number that doesn’t change when the worksheet is calculated, enter =RAND() in the formulas bar and then press F9 to convert the formula into its result.

Multiple random numbers:
To generate a set of random numbers in multiple cells:
select the cells, enter =RAND() and press control + enter. 

To generate a random number between 2 numbers use:
=RANDBETWEEN(number1, number2)
Example:
=RANDBETWEEN(1,9979879) //result 78908 – First save of excel sheet
=RANDBETWEEN(1,9979879) //result 2775 – Second save of excel sheet

Both the function generates new value every time the excel sheet is updated. Use above instruction under “Automatic recalculation:” to keep the same result.

Add rand and randbetween output in a cell:
=RANDBETWEEN(10,30)+RAND() // result 26.90

Note:
In Excel 365, the RANDARRAY function is another way to generate multiple random numbers, and to generate random numbers between two values.

Related Posts

One thought on “Excel RAND & RANDBETWEEN function

Leave a Reply