< Go Back

Excel RAND Function

The RAND function is a function in Excel which is classified as a Math/Trig Function. It can be used as a worksheet function (WS) which means the RAND function can be inserted into a formula in a cell of a worksheet.

What is the Excel RAND Function?

The RAND function returns random numbers in Excel. These random numbers created are between 0 and 1. It will generate numbers like 0.83362, 0.736323,0.158976, etc.

The RAND function always generates a new random number whenever the worksheet is refreshed.

Formula or Syntax

=RAND()

Arguments or Parameters of the RAND Function

The RAND function does not have arguments or parameters.

How to use the RAND Function in Excel?

The Excel RAND function is used to generate random numbers. Let us consider the detailed illustrations below for better understanding.

Example 1

  • Let us use the RAND function to generate a random number and a set of random numbers. The RAND() is applied directly on the cell of choice.

Figure 1. The RAND function used directly in Excel.

  • When RAND() is used directly, it generates a random number within the cell it is used against.

Figure 2. The random number generated by the RAND function.

  • To create a set of random numbers of your choice, simply extend the cell to the desired number.

Figure 3. The RAND function generates a set of random numbers.

Example 2

  • Let us consider using a lottery system. It generates 6 random numbers for only 5 hours a day, and these numbers are between 1 and 50. The formula for the RAND function used is =RAND() *(b-a)+a.

Figure 4. The use of the RAND function between two numbers in Excel.

  • The results for the first hour will appear after the formula is used.

Figure 5. The RAND function in Excel returns decimal numbers.

  • In the remaining hours, the INT function is used with the RAND function in order to make the results whole numbers. The formula is INT(RAND()*(b-a)+a).

Figure 6. The RAND function results changed to the whole number using INT function.

With this formula, the RAND function creates the random decimal numbers while the INT function changes to whole numbers.

Notes

  • Enter =RAND() in the formula bar and press F9 to change a random number created in a cell to a value to prevent it from changes when the worksheet is refreshed.
  • If you want to create random numbers between two numbers, this formula is used: RAND() * (b – a) + a
  • To avoid changing a particular set of random number whenever the worksheet is refreshed, copy the RAND numbers and then use Paste Special > Values to change them to text.
Our customers love us!
“The expert was absolutely amazing and stuck with me the whole way through. They were polite, patient, seemed to want to genuinely help me and provided a solution that I would never have managed otherwise. I could not be more thankful for their support and solution. Thank you!” - - Chris T, in California
This blog is one way to figure it out. A 20 minute chat session with an expert is a better way.Get step-by-step guidance on your question

Leave a Comment

avatar