Excel There are two functions that are very useful when generating random numbers. RAND and RANDBETWEEN.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
How to generate random numbers in Excel
Rand
The RAND function generates a random decimal number from 0 to 1.
1. Select cell A1.
2. Type RAND() and press Enter. The RAND function has no parameters.
3. To generate a list of random numbers, select cell A1, click the lower right corner of cell A1 and drag it down.
Notice that cell A1 has changed. That’s because the random numbers change every time a cell on the sheet changes.
4. If you don’t want this, just copy the random numbers and paste them as Values.
5. Select cell C1 and look at the formula bar. This cell now holds a value, not the RAND function.
RandBetween
The RANDBETWEEN function generates a random integer between two values.
1. Select cell A1.
2. Type RANDBETWEEN (50,75) and press Enter.
3. If you want to generate random decimal numbers from 50 to 75, modify the RAND function as follows:
RandArray
If you are using Excel 365, you can use the RANDARRAY function.
1. By default, the RANDARRAY function generates random decimal numbers from 0 to 1.
2. The RANDARRAY function below creates an array of integers, 10 rows x 1 column, from 20 to 80.
Note: The Boolean TRUE (fifth parameter) of the RANDARRAY function returns an array of integers. Use FALSE to return an array of decimals from 20 to 80.
In addition, you can also view many other excel articles here.