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 called: RAND. For the session, we are using Excel 2019, feel free to use yours (at least 2003).

Overview - Excel RAND Function

Practice Workbook

You are welcome to download the practice workbook from the link below.

RAND Function

1. Basics of RAND

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

Syntax - Excel RAND Function

Summary

Returns a random number greater than or equal to 0 and less than 1.

Syntax

RAND ()

Arguments

No argument is needed.

Versions

Workable from Excel 2003.

2. Usage of RAND

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()

Basic use - Excel RAND Function

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

II. Generate Random Numbers 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

upto 100 - Excel RAND Function

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

III. Generate Random Numbers Between Two Specific Numbers

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 between specific numbers - Excel RAND Function

Here we have generated random values between 5 and 6.

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

Random between specific numbers 2- Excel RAND Function

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. To know more about the function visit this INT article.

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 - Excel RAND Function

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

V. Generate Random Numbers Up To Desired Decimal

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.

ROUND random - Excel RAND Function

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.

ROUND random values 2 - Excel RAND Function

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.

3. Quick Notes

  1. You can generate random numbers in multiple cells at once. All you need to do is select the cells and write the RAND function.

Select cells & RAND- Excel RAND Function

We have selected two cells here and written RAND. And it generated random values in that two cells (image below).

Multiple random values at once

 

2. Every time you 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.

Conclusion

That’s all for today. We have tried showing how you can use the RAND function. 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 have stuck, we are ready to help.


Further Readings

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

ExcelDemy
Logo