Wauvel

Excel like a finance pro.

← The library

Math function

RANDBETWEEN

Returns a random whole number between two values you give.

Very commonDifficulty 1000 · CapableUsage rank #128 of 520
Practice · 4 questions →

When to use it

Returns a random integer between two bounds, inclusive. Test data, dice, and sampling row numbers.

The shape of it

Syntax
=RANDBETWEEN(bottom, top)

Worked examples

  • Dice

    =RANDBETWEEN(1,6) 3

    A dice roll.

  • Random ID

    =RANDBETWEEN(1000,9999) 4817

    A four-digit code.

  • Random date in a year

    =RANDBETWEEN(DATE(2025,1,1),DATE(2025,12,31)) 7/22/2025

    Dates are serial numbers, so the bounds can be dates. Format the cell as a date.

Worth knowing

  • Pick a random row: =INDEX(A2:A100,RANDBETWEEN(1,99)).
  • Freeze results with Paste Special, Values, or they change on every recalculation.
  • For decimals with a step, multiply: RANDBETWEEN(0,100)/4 gives quarters.

Where it goes wrong

  • #NUM! when the bottom bound is larger than the top.
  • Repeated values are expected; it is not a shuffle. Use RANDARRAY with SORTBY for a shuffle without repeats.

Related

Learn the moves here — or let Wauvel run them on your numbers.

Meet your AI CFO →

One CFO-grade Excel tip a week

A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.