# MS Excel: RANDBETWEEN Function (WS)

This Excel tutorial explains how to use the Excel RANDBETWEEN function with syntax and examples.

## Description

The Microsoft Excel RANDBETWEEN function returns a random number that is between a bottom and top range. The RANDBETWEEN function returns a new random number each time your spreadsheet recalculates.

## Syntax

The syntax for the RANDBETWEEN function in Microsoft Excel is:

`RANDBETWEEN( bottom, top )`

### Parameters or Arguments

bottom
The smallest integer value that the function will return.
top
The largest integer value that the function will return.

Note: If bottom is a greater than top, the RANDBETWEEN function will return #NUM! error.

## Applies To

The RANDBETWEEN function can be used in the following versions of Microsoft Excel:

• Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007

## Type of Excel Function

The RANDBETWEEN function can be used in Microsoft Excel as the following type of function:

• Worksheet function (WS)

## Example (as Worksheet Function)

Let's look at some Excel RANDBETWEEN function examples and explore how to use the RANDBETWEEN function as a worksheet function in Microsoft Excel:

Based on the Excel spreadsheet above, the following RANDBETWEEN examples would return:

```=RANDBETWEEN(A1,A2)
Result: random number   (between 1 and 5)

=RANDBETWEEN(1,5)
Result: random number   (between 1 and 5)

=RANDBETWEEN(B1,B2)
Result: random number   (between 10 and 20)

=RANDBETWEEN(100,200)
Result: random number   (between 100 and 200)

=RANDBETWEEN(200,100)
Result: #NUM!           (because bottom is greater than top)```
Share: