How can I use the RANDBETWEEN function in Excel with decimals?

The RANDBETWEEN function in Excel is a powerful tool that allows users to generate random numbers within a specified range. While the function is commonly used for whole numbers, it can also be used with decimal numbers by simply adjusting the parameters of the function. By incorporating decimals into the range, the RANDBETWEEN function can provide users with a more precise and customizable set of random numbers. This feature can be particularly useful in various applications, such as creating random sample data or conducting simulations. By understanding how to use the RANDBETWEEN function with decimals, users can expand their use of Excel and enhance their data analysis capabilities.

Excel: Use RANDBETWEEN Function with Decimals


You can use the RANDBETWEEN function in Excel to generate a random integer between two specific numbers.

However, if you’d like to generate a random value with decimals between two specific numbers, then you can use the following syntax:

=RANDBETWEEN(20*1000,50*1000)/1000

This particular formula will generate a random number with three decimal places between 20 and 50.

The following example shows how to use this formula in practice.

Example: Use RANDBETWEEN Function with Decimals in Excel

Suppose we would like to generate a random integer between 20 and 50.

We can type the following formula into cell A1 to do so:

=RANDBETWEEN(20, 50)

The following screenshot shows how to use this formula in practice:

The formula returns a value of 27.

Notice that this number is an integer and does not include any decimal places.

Suppose instead we’d like to generate a random number with three decimals between 20 and 50.

We can type the following formula into cell A1 to do so:

=RANDBETWEEN(20*1000,50*1000)/1000

The following screenshot shows how to use this formula in practice:

The formula returns a value of 27.991.

Notice that this value includes three decimal places since we multiplied both the lower and upper value in the RANDBETWEEN function by 1,000 and then divided the final result by 1,000.

If we would instead like to include only two decimal places, we could use 100 instead of 1,000 in the formula.

For example, we could instead type the following formula into cell A1:

=RANDBETWEEN(20*100,50*100)/100

The following screenshot shows how to use this formula in practice:

The formula returns a value of 27.83.

Notice that this value includes two decimal places since we multiplied both the lower and upper value in the RANDBETWEEN function by 100 and then divided the final result by 100.

Additional Resources

The following tutorials explain how to perform other common operations in Excel:

x