RAND Function

The Excel RAND function returns a random number between 0 and 1. RAND recalculates when a worksheet is opened or changed.

Purpose:

Get a random number between 0 and 1.

Return Value:

Any decimal number between 0 and 1.

Syntax:

=RAND()

Usage:

  • RAND() function will returns a number between 0 and 1. For example, = RAND() will generate  a number like 0.45554533.
  • RAND() calculates a new value each time the worksheet is calculated. To stop random numbers from being updated, copy the cells that contain RAND to the clipboard, then use Paste Special -> Values to convert to text.
  • To get a 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 in to its result.
  • To generate a set of random numbers in multiple cells, select the cells, enter RAND() and press ctrl+enter.
  • To generate a random number between a and b, use this formula: rand()*(b-a)+a

Rand Function Examples

In the following spreadsheet, the Excel Rand function is used to generate random numbers between different limits.

Note that the above formulas will return a different random number every time the spreadsheet recalculates. To force a recalculation at any time, press the F9 key.