How to Generate Random Numbers with RANDBETWEEN in Excel

Tap through each step to generate random numbers in Excel using RANDBETWEEN.

  1. Click the cell where you want the random number

    Click the cell you want to fill with a random value.

  2. Enter the RANDBETWEEN function

    Type "=RANDBETWEEN(1,100)" to display a random integer between 1 and 100.

  3. Copy it to more cells with the fill handle

    Drag the fill handle to fill other cells, and each one recalculates its own random value.

  4. Lock the values by copying and pasting as values

    If you don't want the numbers to keep changing, copy the range and use "Paste Special > Values" to freeze the results.

  5. Why this is useful

    Whenever you need to decide a drawing order or generate sample test data, RANDBETWEEN gives you random numbers within any range you choose in seconds.

Why the numbers keep changing

RANDBETWEEN is a "volatile" function, meaning Excel recalculates it every time anything on the sheet changes β€” not just when you edit the formula's own cell, but on almost any edit, or when you press F9 manually. That's expected behavior, not a bug, and it's exactly why the paste-values trick above exists for whenever you need a fixed result to hand off or record.

Combine it with other tools for real tasks

On its own, RANDBETWEEN is handy for quick raffle orders or filler test data, but it becomes more useful paired with other tools: wrap it in ROUND for random values with decimals, use it in a helper column together with RANK or a sort to shuffle a list of names, or generate a batch of sample records for testing a form or database before real data exists.

Frequently Asked Questions

Can RANDBETWEEN generate the same number twice?

Yes. Each cell calculates independently, so duplicates are entirely possible, especially with a small range or many cells. If you need a guaranteed set of unique random numbers, you'll need an extra step, such as pairing RANDBETWEEN with a rank-based helper column or a dedicated shuffle approach.

Why do my random numbers change every time I open or edit the file?

That's because RANDBETWEEN recalculates automatically whenever the sheet changes, since it's a volatile function by design. If you need the current numbers to stay fixed, copy the cells and use Paste Special > Values before saving or sharing the file.