top of page

How to use the RAND Function in Excel - 3 Examples


The RAND function is the most simple of the randomized Excel functions (see RANDBETWEEN and RANDARRAY, the more complex and feature rich functions), and will generate a random real number between 0 and 1.


Syntax

= RAND()

There are no arguments for the RAND function.


Explanation

This function is part of the "Math and Trigonometry" function group. Its sole purpose is generate a randomly distributed decimal number between 0 and 1.


RAND is a volatile function, which means that the value generated will change every time any cell in the workbook is changed or updated.


Examples

1. How to Generate a Random Number Between 0 and 1

This is the standard use for RAND. Using the formula below, a random number between 0 and 1 will be generated. The results are normally distributed and will give you a decimal number.

= RAND()

2. How to Generate a Random Number Between Two Values

Normally you would want to use the RANDBETWEEN function to accomplish this, but there is one advantage to using RAND. With RAND and the formula below, you can generate a decimal number between to values rather than the whole numbers that RANDBETWEEN returns.

= RAND()*(bottom - top) + top

3. How to Generate a Random Number Between 0 and X

Here we can multiply a RAND number which will be between 0 and 1, by any number of our choice to set a new largest value ceiling. Essentially just moving the decimal to create a larger number.

= RANDARRAY() * X

bottom of page