Math & Trig
RANDBETWEEN Function in Excel
Returns a random integer between two specified numbers.
Syntax
- =RANDBETWEEN(bottom, top)
Arguments
- bottom (required): Smallest integer to return
- top (required): Largest integer to return
Examples
- =RANDBETWEEN(1, 100) - Random integer 1-100 - Result: Random integer
- =RANDBETWEEN(1, 6) - Simulate dice roll - Result: 1-6
Excel RANDBETWEEN function documentation
- RANDBETWEEN returns a random integer between two bounds, inclusive.
- Syntax: =RANDBETWEEN(bottom, top). Volatile like [RAND](/functions/rand/).
- Ideal for dice rolls, random IDs in test data, sampling integer SKUs, and games.
- Related: [RAND](/functions/rand/), [RANDARRAY](/functions/randarray/), [CHOOSE](/functions/choose/).
RANDBETWEEN syntax and limits
- bottom and top must be integers — Excel rounds if decimals supplied.
- bottom > top returns #NUM!.
- Freeze results: copy → Paste Values before publishing draws.
- Large spreadsheets with many RANDBETWEEN cells increase recalc time.
Step-by-step: random team assignment
- Step 1 — List of names in A2:A50.
- Step 2 — Random team 1–4: =RANDBETWEEN(1,4) in B2 copied down.
- Step 3 — Paste values on column B to lock assignments.
- Step 4 — Pivot count per team for balance check.
- Step 5 — Reseed by recalculating F9 or editing any cell.
RANDBETWEEN vs RAND vs RANDARRAY
- RANDBETWEEN — inclusive integers in range.
- RAND — unit interval decimal; scale manually.
- RANDARRAY(rows, cols, min, max, TRUE) — spill block in 365.
- Pick random name: =INDEX(names, RANDBETWEEN(1, COUNTA(names))).
Worked examples to copy
- Dice: =RANDBETWEEN(1,6).
- Percent lottery: =RANDBETWEEN(1,100).
- Random row: =INDEX(A:A, RANDBETWEEN(1, COUNTA(A:A))).
- Two dice: =RANDBETWEEN(1,6)+RANDBETWEEN(1,6).
People also ask
- RANDBETWEEN change on open? — Recalculates when workbook calculates.
- Same number repeats? — Random; duplicates possible in small ranges.
- RANDBETWEEN decimals? — Function returns integers only.
- RANDBETWEEN in Excel online? — Supported in modern Excel web.
Common errors
- #VALUE! if bottom > top
- Recalculates on every change
Use cases
- Random selection
- Games
- Sampling
Frequently asked questions
- How do I simulate rolling dice in Excel? Use =RANDBETWEEN(1,6) for a single die. For two dice: =RANDBETWEEN(1,6)+RANDBETWEEN(1,6). For a D20: =RANDBETWEEN(1,20). Each recalculation 'rolls' again. Press F9 to recalculate and get new rolls.
- How do I randomly select from a list? Use =INDEX(list, RANDBETWEEN(1, COUNTA(list))). If names are in A1:A10: =INDEX(A1:A10, RANDBETWEEN(1,10)) picks a random name. For unique selections without repeats, use RANDARRAY with SORTBY instead.
- Can RANDBETWEEN generate decimal numbers? No, RANDBETWEEN only returns integers. For random decimals in a range, use =RAND()*(top-bottom)+bottom. For example, random between 1.5 and 3.5: =RAND()*2+1.5.
Editorial review
- Reviewed by Excel.Directory Editorial Team. Updated May 2026.
When to use RANDBETWEEN
- Random selection — common Math & Trig scenario for RANDBETWEEN.
- Games — common Math & Trig scenario for RANDBETWEEN.
- Sampling — common Math & Trig scenario for RANDBETWEEN.
RANDBETWEEN in the Math & Trig category
- Browse all Math & Trig functions at /categories/math-trig/ for related formulas.
- RANDBETWEEN syntax: =RANDBETWEEN(bottom, top)
- bottom (required): Smallest integer to return
- top (required): Largest integer to return
- Confirm RANDBETWEEN arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
Formula checklist before you copy down
- Confirm RANDBETWEEN arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
- If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
- Spot-check three known input rows manually against expected output.
Related Excel functions
- RAND (/functions/rand/): Returns a random decimal number between 0 and 1.
- RANDARRAY (/functions/randarray/): Returns an array of random numbers.
Errors to watch for
- #VALUE! if bottom > top — review causes on linked error pages in the directory.
- Recalculates on every change — review causes on linked error pages in the directory.
Copy-paste audit workflow
- Enter RANDBETWEEN on three test rows with known expected output documented on a QA tab.
- Fill down only after absolute references are locked on lookup tables and rate tables.
- Compare against manual calculation or a calculator for financial and statistical functions.
- Search this directory for comparison guides when choosing between similar functions in the same category.
RANDBETWEEN worked examples to copy
- =RANDBETWEEN(1, 100) — Random integer 1-100. Expected result: Random integer.
- =RANDBETWEEN(1, 6) — Simulate dice roll. Expected result: 1-6.
RANDBETWEEN reference summary for crawlers and offline review
- RANDBETWEEN belongs to the Math & Trig category in Excel. Returns a random integer between two specified numbers.
- Full syntax: =RANDBETWEEN(bottom, top). Open /functions/randbetween/ for parameters, FAQs, and related pages.
- Common mistakes: #VALUE! if bottom > top; Recalculates on every change
- Pair this function with comparison guides when another Excel formula might fit the same task better.
- Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.