How to Generate Random Numbers in Excel
Produce random decimals or whole numbers in a range with a single function — and the trick to freeze them so they stop changing every time the sheet recalculates.
The quick answer: =RAND() for a decimal between 0 and 1, =RANDBETWEEN(1,100) for a whole number in a range. Both refresh on every recalculation — the trick to stop that is below.
Random decimal — RAND
=RAND() returns a random decimal from 0 up to (not including) 1. For a decimal in a custom range, scale it: =RAND()*(100-1)+1 gives a random decimal between 1 and 100.
Whole number in a range — RANDBETWEEN
=RANDBETWEEN(1,100) returns a random integer from 1 to 100, both ends included. Swap the numbers for any range — dice rolls are =RANDBETWEEN(1,6).
Many at once — RANDARRAY (365)
=RANDARRAY(10,1,1,100,TRUE) spills ten random whole numbers between 1 and 100 down a column. The final TRUE asks for whole numbers; drop it for decimals.
Stop them changing — freeze the values
RAND and RANDBETWEEN reroll on every edit, which is rarely what you want in a finished sheet. Select the cells, copy, then Paste Special → Values — shortcut Alt + E + S + V, then Enter — over the same cells. The formulas become fixed numbers that stay put.
Analyze your Excel data with AI
Ask questions about your spreadsheet in plain English and get answers in seconds. Free to start.
Try Quiriz free →