RANDBETWEEN Function

Returns a random whole number between two numbers you choose.

Category

Math & Trig

Available in

All versions, Microsoft 365

Returns

A whole number

Taught hands-on in Level 4: Advanced Dynamic Arrays & Logic - Dynamic Arrays module

Overview

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

It's ideal for test data — order quantities, ages, scores — and for random selections.

Syntax

=RANDBETWEEN(bottom, top) Explain

Arguments

ArgumentRequired?What it does
bottomYesThe smallest number it can return.
topYesThe largest number it can return.

Examples

Example 1 — Test order quantities

Random quantities from 1 to 50.

=RANDBETWEEN(1, 50) Explain

Example 2 — Pick a random winner

Choose one name from A2:A40.

=INDEX(A2:A40, RANDBETWEEN(1, ROWS(A2:A40))) Explain

Common mistakes

  • Recalculates constantly. Paste as values once you have the numbers you want.

Notes

Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.