ID EN
#Math

RAND

Excel Functions

Get a random number between 0 and 1

Return Value

A number between 1 and 0

Details

The RAND function returns a random decimal number between 0 and 1. For example, =RAND() will generate a number like 0.422245717. The RAND function takes no arguments. RAND recalculates when a worksheet is opened or changed. RAND takes no arguments: 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. To generate a set of random numbers in multiple cells, select the cells, enter =RAND() and press control + enter.

Examples

Examples

RAND takes no arguments:

EXCEL
=RAND() // returns number like 0.073979356
=RAND() // returns number like 0.080313118
Random number between

To generate a random number between a and b, you can use a formula like this:

EXCEL
RAND()*(b-a)+a
Random number between

For example, to generate a random number between 1 and 9:

EXCEL
RAND()*(9-1)+1
Random number between

The RANDBETWEEN function can generate random integers between to numbers:

EXCEL
=RANDBETWEEN(1,9) // random number between 1-9

See Also

RANDBETWEEN RANDARRAY