RAND function

This article describes the formula syntax and usage of the RAND function in Microsoft Excel.


RAND returns an evenly distributed random real number greater than or equal to 0 and less than 1. A new random real number is returned every time the worksheet is calculated.

Note: As of Excel 2010, Excel uses the Mersenne Twister algorithm (MT19937) to generate random numbers. 



The RAND function syntax has no arguments.


  • To generate a random real number between a and b, use:


  • If you want to use RAND to generate a random number but don't want the numbers to change every time the cell is calculated, you can enter =RAND() in the formula bar, and then press F9 to change the formula to a random number. The formula will calculate, and leave you with just a value.


Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.





A random number greater than or equal to 0, and less than 1



A random number greater than or equal to 0, and less than 100



A random whole number greater than or equal to 0, and less than 100


Note: When a worksheet is recalculated by entering a formula or data in a different cell, or by manually recalculating (press F9), a new random number is generated for any formula that uses the RAND function.

See Also

Description of the RAND function in Excel

Mersenne Twister algorithm


Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.