How to Generate Random Numbers in Excel
Last updated: July 9, 2026
Excel has built-in functions for generating random numbers. This guide covers the three you'll use most, with examples. Prefer a one-click tool? Try our free Random Number Generator.
RAND: a random decimal between 0 and 1
The RAND() function returns a random decimal greater than or equal to 0 and less than 1.
=RAND()
To get a random decimal between two values a and b, use:
=RAND()*(b-a)+a
RANDBETWEEN: a random whole number in a range
The most popular option. RANDBETWEEN(bottom, top) returns a random integer between the two values, inclusive.
=RANDBETWEEN(1, 100)
This gives a whole number from 1 to 100. Drag the formula down a column to generate a whole list at once.
RANDARRAY: many random numbers at once
In Microsoft 365 and Excel 2021, RANDARRAY() fills a range with random numbers in a single formula.
=RANDARRAY(5, 1, 1, 100, TRUE)
This produces 5 rows, 1 column, whole numbers from 1 to 100. Set the last argument to FALSE for decimals.
Common tasks
Random numbers with no repeats
Excel's random functions can repeat values. To get unique numbers, generate a column of RANDBETWEEN values, then remove duplicates, or use =SORTBY(SEQUENCE(100), RANDARRAY(100)) and take the first N. Our generator has a built-in "No repeats" toggle that does this for you.
Stop numbers from changing
Excel's random functions recalculate every time the sheet changes. To freeze a result, copy the cells and use Paste Special → Values.
Excel vs an online generator
Excel is great when your data already lives in a spreadsheet. For a quick, shareable result, no-repeats draws, or generating names, words and passwords, an online tool is faster. Explore the full set of Toolssy generators.