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 in Excel (RAND function), how to use the Random function and examples Picture 1

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

Random function in Excel (RAND function), how to use the Random function and examples Picture 2

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:

Random function in Excel (RAND function), how to use the Random function and examples Picture 3

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:

Random function in Excel (RAND function), how to use the Random function and examples Picture 4

Above is the description and how to use the Rand () function to get random values ​​in Excel hoping to help you. Good luck!

4.5 ★ | 2 Vote

May be interested

  • Excel date function - Usage and examplesExcel date function - Usage and examples
    the date counting function in excel is one of the most effective functions of this software. because excel usually works in the field of statistics and calculations, it is extremely necessary to record dates. to help you understand this function, let's come to the following article of tipsmake.
  • The MID function in Excel, how to use the MID function, and examplesThe MID function in Excel, how to use the MID function, and examples
    the mid function in excel, how to use the mid function, and examples. the mid function in excel is a function of the text function group, you use the mid function if you want to cut the string in the middle of the text string when processing the string. if you do not know or do not understand the mid function, then you
  • DSUM function in Excel, how to use DSUM function and examplesDSUM function in Excel, how to use DSUM function and examples
    dsum function in excel, how to use dsum function and examples. the dsum function in excel is a fairly common function with a fairly simple usage. but if you do not know how to use the dsum function, you can refer to the following article to understand h
  • The function srand () in CThe function srand () in C
    the function void srand (unsigned int seed) provides seed for the random number generator used by the rand function.
  • PMT function in Excel - Usage and examplesPMT function in Excel - Usage and examples
    the pmt function is one of the built-in financial functions of the excel software used to calculate the payment for a loan based on regular payments and a constant interest rate. the pmt function is not only useful for businesses, but also very practical for users if you want to calculate a loan.
  • The RAND function returns a random real number, greater than or equal to 0 and less than and equal to 1The RAND function returns a random real number, greater than or equal to 0 and less than and equal to 1
    the rand () function returns a random real number, greater than or equal to 0 and less than and equal to 1.
  • GAMMAINV function in Excel, how to use and examplesGAMMAINV function in Excel, how to use and examples
    the gammainv function in excel helps calculate the inverse value of the cumulative gamma distribution, which is used in statistics and data analysis. this article will guide you on how to use the gammainv function with specific illustrative examples.
  • How to use the MAXA function in Excel, detailed examplesHow to use the MAXA function in Excel, detailed examples
    the maxa function in excel helps find the largest value in a data set, including numbers, logical values, and text containing numbers. this is different from the max function, which only counts numbers. let's learn the syntax and usage of the maxa function with practical examples.
  • LEFT function in Excel, how to use LEFT function and illustrative examplesLEFT function in Excel, how to use LEFT function and illustrative examples
    left function in excel, how to use left function and illustrative examples. left function in excel is a function of string processing function, you use left function when you need to cut the character string to the left of the text string. if you need to learn more about mid functions, be patient
  • How to use the SUMIF function in ExcelHow to use the SUMIF function in Excel
    the sumif function in excel is a function used to compute values ​​in a specified range. the sumif function can be used for summing cells based on the date, data and text that are connected to the specified area.