How to use RANDBETWEEN function in Excel?

The `RANDBETWEEN` function in Excel is used to generate a random integer between two specified numbers. Here’s how you can use it:

Syntax

RANDBETWEEN(bottom, top)
  • bottom: This is the smallest integer that the function can return.
  • top: This is the largest integer that the function can return.

Steps to Use `RANDBETWEEN`

  • Select the Cell: Click on the cell where you want the random number to appear.
  • Enter the Formula: Type `=RANDBETWEEN(`, followed by the two numbers (bottom and top) you are specifying, separated by a comma.
  • Complete the Function: Close the parenthesis and press `Enter`.

Example

If you want to generate a random number between 1 and 100, you would type:

=RANDBETWEEN(1, 100)

Important Points

  • Volatile Function: `RANDBETWEEN` is a volatile function, meaning it recalculates and generates a new random number every time there is a calculation performed in the workbook (such as when any cell is edited or when the file is opened).
  • Prevent Recalculation: If you want to prevent the number from recalculating, you can copy the cell with the random number and then paste it as a value (using `Paste Special`) to keep a static number.
  • Versions: `RANDBETWEEN` is available in Excel 2007 and later versions. If you are using an earlier version of Excel, you might need to use the `RAND` function in combination with other formula techniques to achieve similar functionality.

Using the `RANDBETWEEN` function is useful for simulations, generating random test data, and other activities requiring random number generation within a specified range.

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project