How to Use RAND Function in Excel (5 Examples)

Excel provides several math functions to help you perform mathematical tasks easily and swiftly. Today we are going to show you how to use a function in Excel called: RAND. For the session, we are using Excel 2019, feel free to use yours (at least 2003).

excel RAND function


Introduction to RAND Function in Excel

RAND is categorized under the Math & Trig functions in Excel. This function returns a random number between 0 and 1.

  • Syntax

The syntax of the function is:

=RAND()

overview of Excel RAND function

  • Arguments

This function doesn’t require any argument.

  • Versions

Workable from Excel 2003 and afterward versions.


How to Use RAND Function in Excel: 5 Useful Applications

I. Generate Random Numbers Between 0 and 1

From the description of the RAND function, you have understood that it’s the basic operation of this function to generate random values between 0 and 1.

To do the task all you need to write:

=RAND()

 RAND Function to Generate Random Number Between 0 and 1

Here we have generated 5 random numbers using the RAND function. Values are between 0 and 1.


II. Generating Random Number Between 0 and 100

Apart from numbers between 0 and 1, we can produce random values from 0 to 100.

Our formula will be

=RAND()*100
Generating Random Number Between 0 and 100

Using the formula, we have generated 5 random values between 0 and 100.


III. Using RAND Function to Generate Random Numbers Between Two Specific Numbers in Excel

You can choose your preferred numbers to find random values between them.

Let’s imagine, we have two values, a and b, we will find random values within the range of these two. To find the random values between these two our formula will be

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

Here we multiply the difference between the two numbers with the random value generated by the RAND function. Then add the starting number with that value.

Write the formula replacing a and b with your desired numbers.

Random number between 5 and 6

Here we have generated random values between 5 and 6.

We can choose any numbers to choose a random value between them.

Random number between 5 and 6


IV. Generate Random Integer Numbers

In most cases, the RAND function will generate decimal numbers. If you want to generate integer values then you need to use the INT function.

The INT function returns the integer part of a decimal number by rounding it down to the integer.

We will use a nested formula of INT and RAND combination.

=INT(RAND())

If we write only this, 0 will be generated. Just to show you examples we are aiming to generate numbers between 0 to 100. Then the formula will be

=INT(RAND()*100)

Random Integer Number Using RAND Function in Excel

Here we have produced 5 random integers between 0 and 100. In place of 100, you can set your preferred number(s).


V. RAND Function to Generate Random Number Up to Desired Decimal in Excel

The RAND function emanates random values of decimal numbers. You can set up to which point you want to see decimal values.

Again, we need to use a nested formula, combining the RAND function alongside the ROUND function.

The ROUND function returns a number rounded to a given number of digits. For further information, visit this ROUND function article.

Let’s say that we want to see up to 2 decimal points, then we need to set 2 at the num_digits field of ROUND. 

=ROUND(RAND()*100,2)

Here our formula will generate a random value between 0 to 100 with up to 2 decimal points.

random value between 0 to 100 with up to 2 decimal points

Here we have found the value from 0 to 100 with up to 2 decimal points.

You can select your operation with the RAND function and choose decimal points depending on the circumstances.

RAND Function to Generate Random Number Up to Desired Decimal

Here we have generated values between different ranges and decimal points.

Similar to the above image, various operations or tasks can be done with RAND before using the ROUND function.


Things To Remember

  • We can generate as much different numbers as we can using RAND function up to any decimal places.
  • RAND function only generates value between 1 and 0. For any other results, we will need to modify it.
  • Every time we perform a task the random values will be changed. If you don’t want this, then copy the value and paste it as Paste Values.

Practice Workbook

Download the following workbook that we used to write this article so that you can practice along with it while reading the article.


Conclusion

That’s all for today. We have tried showing how you can use the RAND function in Excel. You can use the function to find the random values from different ranges as well as in different presentations. Hope you will find this helpful. Feel free to comment if anything seems difficult to understand. Let us know any of your RAND function-related scenarios where you are stuck, we are ready to help.


<< Go Back to Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Shakil Ahmed
Shakil Ahmed

My name’s Shakil. My articles are targeted to support you in enriching knowledge regarding different features related to Microsoft Excel. I am fond of literature, hope some knowledge from them will help me providing you some engaging articles even though some weary technical terms.

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo