Excel function

RANDBETWEENfunction

Returns a random integer between two numbers.

All versions

What is the RANDBETWEEN function?

=RANDBETWEEN(bottom, top)

RANDBETWEEN returns a random integer between bottom and top, both included.

If bottom is larger than top, it returns #NUM!. The value changes on every recalculation.

RANDBETWEEN makes dummy test data (scores, quantities, dates) and picks one item at random from a list. Both ends are included, so =RANDBETWEEN(1, 6) returns 1 and 6 as often as any other number.

Arguments

bottom
The smallest integer that can be returned.
top
The largest integer that can be returned.

RANDBETWEEN examples

  1. Example 1. A lottery number

    =RANDBETWEEN(1, 45)

    One of 1 to 45.

  2. Example 2. A die

    =RANDBETWEEN(1, 6)

    1 to 6.

  3. Example 3. A random date

    =RANDBETWEEN(DATE(2026,1,1), DATE(2026,12,31))

    Format the cell as a date for a random day in 2026.

  4. Example 4. Dummy data

    =RANDBETWEEN(50, 100)

    Choose a range for each column and copy down. Results change on every recalculation.

    ColumnFormulaSample
    Score=RANDBETWEEN(50, 100)73
    Qty=RANDBETWEEN(1, 40)18
    Amount=RANDBETWEEN(10, 100)*1004,700
  5. Example 5. Steps of 0.1

    =RANDBETWEEN(0, 100)/10

    Returns 0.0 to 10.0 in steps of 0.1.

Common mistakes

FAQ

Random decimals?
Use RAND.
Random pick from a list?
Use =INDEX(list, RANDBETWEEN(1, ROWS(list))).
Numbers with no repeats?
RANDBETWEEN can repeat. Make a RAND column and use RANK on it.