The Excel Rand function generates a random real number between 0 and 1.
The function takes no arguments and therefore, its syntax is :
Although the number generated is between 0 and 1, you can use the function to generate a random real number between any two supplied limits a and b, using the formula:
The spreadsheet below shows three examples, in which the Excel Rand function is used to genrate random numbers between different limits.
|1||=RAND( )||- returns a random real number between 0 and 1|
|2||=RAND( ) * 100||- returns a random number between 0 and 100|
|3||=RAND( ) * 10 + 10||- returns a random number between 10 and 20|
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.
Further information on the Excel Rand Function is provided on the Microsoft Office website.