Home Privacy Policy Feedback Link to us Site Map Forums

Excel: Rand Function


In Excel, the Rand function returns a random number that is greater than or equal to 0 and less than 1. The Rand function returns a new random number each time your spreadsheet recalculates.

The syntax for the Rand function is:

Rand( )


Note:

To create a random number between two numbers, you can use the following formula:

=Rand()*(b-a)+a

Where a is the smallest number and b is the largest number that you want to generate a random number for. Please note, that this formula will never generate a number at the highest end of the range.

=Rand()*(25-10)+10

The formula above would generate a random number between 10 and 24.9999999.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

Let's take a look at an examples:

Based on the Excel spreadsheet above:

=Rand()*(A2-A1)+A1 would return a random number between 50 and 149.9999999
=Rand()*(A3-A1)+A1 would return a random number between 50 and 199.9999999
=Rand()*(200-100)+100 would return generate a random number between 100 and 199.9999999