Categories
Excel

Generate random numbers in Excel

In this tutorial, we will learn how to generate random numbers in Excel. RAND() and RANDBETWEEN() can be used to generate random numbers. MS Excel 2021 is used.

For this tutorial, we will be using RAND function and RANDBETWEEN function.

  • RAND() :This function returns a random real number between 0 and 1.
  • RANDBETWEEN(bottom, top): This function returns a random integer between the specified range.

Using RAND function

RAND() function returns a random real number between 0 and 1. This function does not have any arguments in them.

Select the cell where you want the random number, before entering the function, put = and type RAND() and press Enter.

RAND() function

After the random number is generated for a single cell, the same can be done for multiple cells along a column.

Select a cell, drag the bottom right corner along the column so that the same formula is applied to other cells of the column.

The above method only generates random numbers only between 0 and 1. However, we may generate random numbers up to any value by multiplying the function with that specific number.

Using RAND function for range 0 to 100

We will generate random real numbers between 0 and 100 by multiplying the function with 100. After RAND(), multiply 100 by typing *100.

Generating Random numbers between 0 and 100

Using RANDBETWEEN function

If we want integers, we can use RANDBETWEEN function. This function returns a random number between a specified range.

This function has two arguments which specify the range of the random number that will be generated. Bottom is the lower limit and and Top is upper limit of the range.

Syntax: RANDBETWEEN(bottom, top)

Select the cell, where you want the random number, enter the function: =RANDBETWEEN(0,100) .

When we press Enter, we see that we get an integer between the specified range. Select the bottom right corner of the cell and drag it along the column to have a column of random numbers..

Use SUMIF function in MS Excel