Using the RAND Function in Excel

A random selection of colourful rocks. (Image by Thomas Hoang from Pixabay).

  • Applies to: Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel for the web, Excel 2019, Excel 2016, Excel 2019 for Mac, Excel 2013, Excel 2010, Excel 2007, Excel 2016 for Mac, Excel for Mac 2011, Excel Starter 2010.

This post will teach you all about using the RAND function in Excel. Firstly, we will delve into the meaning of this function. Secondly, we will take a look at how the formula is structured. Then, we will explore the vital conditions to consider when using the RAND function in Excel. Finally, there is an example for you to play around with and see how the RAND function works.

What is the RAND Function?

The RAND function is a mathematical function which simply returns an evenly distributed random genuine number greater than or equal to 0 and below 1. A new random real number is captured each time the worksheet is calculated.

Note: From Excel 2010 onwards, Excel applies the Mersenne Twister algorithm (MT19937) to create random numbers. 

Random dice numbers - represent the RAND function.
Image by annca from Pixabay.

Syntax of the RAND Function

RAND()

Unlike other formulas, the RAND function syntax contains absolutely no arguments.

Random numbers included in Pi - symbolise the RAND function.
Image by Gerd Altmann from Pixabay.

Remarks of the RAND Function

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

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

  • If you are looking to deploy RAND to create a random number but prefer not to have the numbers refresh each time the cell is calculated, you can type =RAND() in the formula bar, and then press F9 to modify the formula to a random number. Subsequently, the formula will calculate and leave you with only a value.

Example of the RAND Function

Copy the sample data included in the table underneath, and paste it into cell A1 of a completely new Excel worksheet. For formulas to indicate results, choose them, press F2, and then press Enter. Often, you may need to amend the column widths to gain a full view of the entire dataset in all its glory!

FormulaDescriptionResult
=RAND()A random number greater than or equal to 0 and less than 1varies
=RAND()*100A random number greater than or equal to 0 and less than 100varies
=INT(RAND()*100)A random whole number greater than or equal to 0 and less than 100varies
Note: When a worksheet is recalculated by writing a formula or data in another cell, or by manually recalculating (press F9), a new random number is materialised for any formula that employs the RAND function.

Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.

See Also

Mersenne Twister algorithm

RANDBETWEEN function

Software Bytes – Official Website

Back to Excel Tutorial

Leave a Reply

%d bloggers like this: