Random function in Excel (RAND function), how to use the Random function and examples
You need to get a random value in a range of values. To avoid duplicate values and objectivity, you should use the Rand () function . The following article introduces the Rand function () in detail - the usage and examples of the Rand () function application in Excel.
Random function description
The RAND () function returns a random real number. It can be a real number greater than zero or less than any number, even if it is an alphabet letter.
Random function syntax
RAND ()
- The function Rand () is a function that does not contain a return value parameter and will be random numbers in the range of 0 to 1.
- Want to get random values in any range, for example, values greater than 0 and less than n execute the following statement: = RAND () * n
- You want to get random values greater than or equal to n and less than m to execute the command:: = RAND () * (mn) + n
Note when using the Random function
- RAND () function is a function that returns random values and this value will change every time you update or reopen the spreadsheet.
- In case you want to save the first value of the RAND () function, do not want to change that value, you just need to press F5 and then press Enter the first value the RAND () function will be saved permanently.
Example of the Random function
Example 1: Using the RAND () function performs the following requirements:
- Get a random number between 0 and 1.
- Get a random number between 0 and 90
- Get a random number between 88 and 188
Making:
- Get a random number using the syntax = RAND ()
- Get a random number between 0 and 90: = RAND () * 90
- Get a random number between 88 and 188: = RAND () * (188-88) +88
Example 2: Using the RAND () function, get a random number with n digits.
To get a random number using the RAND () function do the following:
- First, use the formula to get a random number in a range and use the Int () function to get the integer part of that random number.
- Second, to fix the number of digits of the random number to be taken, we set n = 10 (x-1) and m = 10x where x is the number of digits of the random number to be taken. For example, take a 4-digit random number using the formula: = INT (RAND () * (10000-1000) +1000)
So, applying the above formula, we have the data table to get random numbers with x digits:
Example 3: Using the RAND () function to get any character in the alphabet
- As you know, the alphabet has 26 letters => use the RAND () function to take any integer between 0 and 26 => use the formula: = INT (RAND () + 26 + 1
- In ANSI encoding, capital letters from 65 to 90 => to get lowercase letters use the formula: = CHAR (INT (RAND () * 26 + 1) +64)
- With lowercase letters in ANSI charset from 97 to 122 => to get lowercase letters using the formula: = CHAR (INT (RAND () * 26 + 1) +96)
Applying the above formula, we have a data table that takes uppercase and uppercase characters:
Above is the description and how to use the Rand () function to get random values in Excel hoping to help you. Good luck!
You should read it
- The function rand () in C
- How to generate random numbers in Google Sheets
- The function srand () in C
- OR function in Excel, how to use the OR function, and examples
- DCount function in Excel - How to use the DCount function and examples using the DCount function
- INDIRECT function in Excel - How to use INDIRECT function and examples using INDIRECT function
- VLOOKUP function to use and specific examples
- How to use the RANDARRAY function to randomly classify data in Excel
- IRR function in Excel - Usage and examples
- Offset function in Excel - Usage and examples
- The MID function in Excel, how to use the MID function, and examples
- How to use the SUMIF function in Excel
Maybe you are interested
How to Build a Random Word Generator Using Bash in Linux
How to generate random numbers in Excel
How to use the RANDARRAY function to randomly classify data in Excel
How to Add Randomly Moving Objects Using Python's Arcade Library
Understanding Random Number Generators: The Science Behind Digital Games
How to limit random touches on the Xiaomi screen