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).
You are welcome to download the practice workbook from the link below.
Excel RAND Function
1. Basics of RAND Function
RAND is categorized under the Math & Trig functions in Excel. This function returns a random number between 0 and 1.
Returns a random number greater than or equal to 0 and less than 1.
No argument is needed.
Workable from Excel 2003.
2. Usage of RAND Function
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
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
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
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.
Here we have generated random values between 5 and 6.
We can choose any numbers to choose a random value between them.
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.
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
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.
Here our formula will generate a 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.
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
- You can generate random numbers in multiple cells at once. All you need to do is select the cells and write the RAND function.
We have selected two cells here and written RAND. And it generated random values in that two cells (image below).
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.
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.
- How to Use RANDBETWEEN Function in Excel (4 Examples)
- How to Use SEQUENCE Function in Excel (16 Examples)
- How to Use SUMIF Function in Excel (With 5 Easy Examples)
- How to Use SUMIFS Function in Excel (6 Handy Examples)
- How to Use MOD Function in Excel (9 Suitable Examples)
- How to Use SUM Function in Excel (With 6 Easy Examples)
- Solving equations in Excel (polynomial, cubic, quadratic, & linear)
- Exponential Notation E in Excel & How to Turn Off Auto Scientific Notation!
- LARGE function in Excel
- SUMPRODUCT() function in Excel