You often need to return a random number between two numbers for sampling purpose or assigning a random value to a data set. Excel RANDBETWEEN function has a built-in function to perform this task.

# Random number between two numbers

Excel **RANDBETWEEN **function returns a random number between two numbers or between given bottom and top range. It is categorized as ** Math/Trig Function** and it returns new random number each time worksheet recalculates.

**Syntax**

The syntax of Excel RANDBETWEEN function is:

`=RANDBETWEEN(bottom, top)`

**Arguments**

There are two required arguments.

**Bottom:** It is the smallest integer value specified that the function will return.

**Top:** It is the largest integer value specified that the function will return.

**Returns**

Excel RANDBETWEEN function returns a random number between two numbers specified in function as the bottom and top numeric values.

**Example**

For example, you want to generate a random number between two numbers i.e. 1 and 50 in a range of cells A2: A21. You need to insert the formula in cell A2 and drag or copy and paste this formula to cell A21. Excel will return a random number between two numbers specified in the formula, such as;

`=RANDBETWEEN(1,50)`

*Figure 1. Random_Between-two-numbers*

## Notes

Please note that RANDBETWEEN function returns a new random number between two numbers whenever you edit any cell in the range containing formulas or you open the worksheet again. If you want to restrict with an initially generated random number between two numbers then you need to replace the formulas with values in the applied range. Simply, select the range of cells A2:A21, **copy the formulas > paste special > and click on values** and save.

## Leave a Comment