Formula Guide

The Excel RANDBETWEEN Function
explained simply

RANDBETWEEN generates a random whole number between two values you specify — useful for sample data, simulations, and randomized selection.

ExcelPro · 3 min read · Updated June 2026
Contents
  1. What does RANDBETWEEN do?
  2. Syntax
  3. 3 examples
  4. Common mistakes
  5. FAQ

What does RANDBETWEEN do?

RANDBETWEEN returns a random whole number between a minimum and maximum value you specify, inclusive of both endpoints.

It recalculates every time the spreadsheet recalculates, so the same formula produces a different result each time unless you freeze it.

Syntax

=RANDBETWEEN(bottom, top)
ArgumentDescription
bottom requiredThe smallest possible value to return.
top requiredThe largest possible value to return.

Examples

Example 1
Random number between 1 and 100
=RANDBETWEEN(1,100)

Returns a random whole number anywhere from 1 to 100, inclusive.

Example 2
Generate test data for a model
=RANDBETWEEN(1000,5000)

Quickly fills a column with plausible random sales figures for testing a spreadsheet model before real data is available.

Example 3
Randomly assign a category
=CHOOSE(RANDBETWEEN(1,3),"A","B","C")

Combines with CHOOSE to randomly assign one of three labels.

Common mistakes

⚠️ Expecting the value to stay fixed

RANDBETWEEN recalculates constantly — paste the result as a value if you need a fixed random number that does not keep changing.

FAQ

How do I freeze a random value once generated?
Copy the cell, then paste it back as a value only (paste special > values) to lock in that specific result.

Practise Excel with real data

ExcelPro has 700+ hands-on Excel exercises across 7 career tracks — free to start, no download needed.

Start practicing free →

Related formulas

CHOOSE ROUND INT