Random

Random Number Generator for Excel and Google Sheets: Functions vs Online Tools

HR
Hassaan Rasheed
· June 16, 2026 12 min read

A split-screen view showing Microsoft Excel on the left with a formula bar displaying RANDBETWEEN(1,100) and cell A1 showing result 47, and a random number generator tool on the right with minimum 1, maximum 100, displaying the same result 47, both on a white desktop background

Most people who generate random numbers in Excel do not actually want a spreadsheet function. They want a number. The formula is the path, not the destination, and the recalculation behavior is the first thing that causes problems. Enter data in any cell and every RANDBETWEEN formula in the workbook silently regenerates. Close and reopen the file and every result is gone. What looked like a documented draw is now a different set of numbers with no record of what the original results were.

The random number generator produces a result that does not change after generation. There is no formula recalculation, no accidental refresh, and the settings (range minimum, maximum, count) are visible alongside the result. For draws where the output needs to mean something after the moment of generation, that stability matters more than the convenience of doing everything in one tool.

This guide covers exactly how RANDBETWEEN and RAND work, where they fit, where they fall short, and when moving the generation step outside of Excel is the more reliable choice.

RANDBETWEEN: The Excel Function for Whole Numbers in a Range

RANDBETWEEN is the Excel function for generating integers within a specified range. The syntax is:

=RANDBETWEEN(bottom, top)

Both arguments are required. Bottom is the minimum value. Top is the maximum. Both can be literal numbers or cell references.

Examples:

  • =RANDBETWEEN(1,6): simulates a single die roll
  • =RANDBETWEEN(1,100): generates a number from 1 to 100
  • =RANDBETWEEN(A1,B1): uses the values in cells A1 and B1 as the range boundaries

The result is always a whole number. If you need the number 1 included and the number 100 included, RANDBETWEEN(1,100) is inclusive on both ends. Setting RANDBETWEEN(1,6) can produce exactly 1 and exactly 6, just like rolling a physical die.

RANDBETWEEN is available in Excel 2007 and later, LibreOffice Calc, and Google Sheets with identical syntax. The function is one of the most portable across spreadsheet applications.

One limit: RANDBETWEEN only generates integers. If your range boundaries are decimals, it rounds them inward. RANDBETWEEN(1.7, 5.3) produces a result from 2 to 5, not 1.7 to 5.3. For decimal ranges, use RAND instead and scale the result.

RAND: When You Need Decimals or a 0-to-1 Distribution

RAND takes no arguments and generates a uniformly distributed decimal number between 0 (inclusive) and 1 (exclusive). The syntax is simply:

=RAND()

On its own, this is useful for probability calculations, simulations, and sorting. Adding RAND as a column next to a list of items and sorting by that column produces a randomly shuffled order, which is a quick way to randomize the sequence of a list.

To generate a decimal in a custom range using RAND, scale the result:

=RAND() * (maximum - minimum) + minimum

For a decimal between 5 and 10: =RAND() * (10-5) + 5

For a whole number in a range using RAND (less common, RANDBETWEEN is cleaner for this):

=INT(RAND() * (maximum - minimum + 1) + minimum)

RAND is the right function when the result needs to be a continuous value rather than a specific integer, or when you are building a formula where the raw probability value feeds into a larger calculation. For most everyday uses, RANDBETWEEN is simpler.

Google Sheets Random Number Functions: Same Syntax, One Difference

Google Sheets implements both RAND and RANDBETWEEN with identical syntax to Excel. Any formula that works in Excel works in Google Sheets without modification for these two functions.

The behavioral difference worth knowing: Google Sheets also offers RANDARRAY, imported from Excel 365. RANDARRAY generates a two-dimensional array of random numbers in a single formula.

=RANDARRAY(rows, columns, min, max, integer)

Setting the fifth argument to TRUE produces integers. Setting it to FALSE produces decimals. This generates a full grid of random numbers without copying a formula across many cells.

For Google Sheets users who need a column of 20 random numbers from 1 to 100, RANDARRAY(20,1,1,100,TRUE) produces all 20 in one formula with the result spilling down 20 rows automatically.

The same recalculation behavior applies in Google Sheets: RAND and RANDBETWEEN both recalculate on every edit. Paste as values to freeze results before sharing the sheet.

The Recalculation Problem and How to Freeze a Result

This is the part that surprises most people the first time it causes a problem. RAND and RANDBETWEEN are volatile functions. They recalculate:

  • Every time you type in any cell in the workbook
  • Every time you press F9
  • Every time the file opens
  • Every time any formula in the workbook recalculates and triggers a chain reaction

The result you saw a minute ago is gone. The formula that appeared to document a raffle draw has already produced a different number by the time someone else opens the file to verify it.

There are three ways to freeze a RANDBETWEEN result after generating it:

Method 1: Paste as values. Copy the cell. Right-click and select Paste Special, then Values. The formula is replaced by the static number. This is the most reliable method.

Method 2: F9 in the formula bar. Click the cell, press F2 to enter edit mode, then press F9. Excel replaces the formula with the current calculated value while still in the formula bar. Press Enter to commit. This works in Excel but not consistently across all spreadsheet applications.

Method 3: Manual copy. Record the result by eye and type it into a different cell as a plain number. Tedious for multiple results but zero risk of formula contamination.

For any draw where the result matters after the moment of generation, freeze the value before doing anything else. One accidental keystroke in an unfrozen workbook changes every RANDBETWEEN result simultaneously.

A Microsoft Excel spreadsheet showing column A with ten RANDBETWEEN(1,50) formulas highlighted in blue, a Paste Special dialog box open with the Values radio button selected, and column B showing the same numbers pasted as static values with no formula in the formula bar

Generating Unique Random Numbers Without Repeats in Excel

RANDBETWEEN can produce the same number more than once across multiple cells. If you need a column of 10 unique random numbers from 1 to 50, ten separate RANDBETWEEN formulas will often produce duplicates.

Excel 365 users have RANDARRAY with the unique parameter, but this feature is not available in older Excel versions or all Google Sheets configurations. The older approach uses a helper column:

  1. In column A, enter the values 1 through 50 (or however large your range is)
  2. In column B, enter =RAND() next to each value
  3. Sort the combined range by column B
  4. The order of values in column A is now a random permutation
  5. Take the first N rows as your unique result set

This works but requires setup, a full list of range values, and careful sorting. Any edit to the RAND column reshuffles the result.

The practical alternative for most users: an online generator with unique mode enabled. The random number generator no repeats guide covers how unique mode works and why the Fisher-Yates shuffle algorithm produces a genuinely uniform distribution of results, equivalent to the helper-column method but without the formula overhead. For lists up to 500 unique numbers, the online generator is typically faster to use than building the helper-column setup from scratch.

When an Online Generator Works Better Than Excel

For static documentation, the online generator wins. A draw run in the number generator shows the range minimum, maximum, count, and whether unique mode was active, alongside the result. That combination functions as a record of how the draw was conducted, not just what it produced.

An Excel RANDBETWEEN formula shows nothing except the current value, which changes every time anyone looks at the file. For a raffle, classroom activity, or team assignment draw where participants might ask how the numbers were picked, the online tool provides an answer. The spreadsheet function does not.

For quick on-the-spot generation with no documentation needed, Excel and Google Sheets are faster if the workbook is already open. Type the formula, press Enter, read the number. For that specific use case, the spreadsheet wins on speed.

For large lists of unique numbers, the comparison is closer. Excel 365's RANDARRAY with unique parameter generates them in one formula. For older Excel versions or users who find the formula syntax confusing, the online generator with unique mode and a count setting is more accessible.

The are online random generators really random guide covers how the browser's crypto.getRandomValues() function compares to Excel's internal random number source in terms of cryptographic quality, which matters for high-stakes draws.

Combining Excel and an Online Tool for Documented Draws

The most practical workflow for formal draws is to use both.

Generate the numbers using the online tool, with the settings (range and count) visible in the interface. Take a screenshot of the result panel. Download the text file if the draw is large. These become the documentation.

Import or manually enter the results into Excel for any further analysis, sorting, or data combination you need. Because the numbers are now static values in the spreadsheet, editing other cells does not regenerate them.

This approach gives you the documentation and reproducibility of an online generator combined with the analysis and formatting tools of a spreadsheet. The random number list generator guide covers the download and copy functions in the online generator, and the random number generator for raffles guide covers structured draw documentation for formal selection processes.

When to Use Each Tool

The decision is straightforward once you know what each tool does reliably.

Use RANDBETWEEN in Excel or Google Sheets when: you are already working in a spreadsheet, the result is temporary and does not need to persist, you need the number to feed directly into a formula, or you are building a simulation that recalculates are part of the design.

Use the online random number generator when: the result needs to be documented, unique numbers are required, multiple people need to see the draw happen or verify the result afterward, or the draw is part of a formal process where the method matters alongside the output.

The random tools section covers everything for number-based selection beyond the generator itself. For any draw that runs inside a spreadsheet and needs to stay there, RANDBETWEEN handles it. For any draw where the result needs to outlast the session, start outside the spreadsheet.

Frequently Asked Questions

Type =RANDBETWEEN(1,100) in any cell to generate a whole number between 1 and 100. Replace the first number with your minimum and the second with your maximum. The function recalculates every time the spreadsheet recalculates, including when you press F9, enter data in any cell, or open the file. To freeze the result, copy the cell and paste it using Paste Special as values only.

Google Sheets uses the same RANDBETWEEN function as Excel. Type =RANDBETWEEN(1,100) in any cell to generate a whole number in that range. Like Excel, the function recalculates on every spreadsheet change. To freeze a result, copy the cell and use Paste Special with values only. For a 0-to-1 decimal instead of a whole number, use =RAND() in either application.

RAND generates a decimal number between 0 and 1 with no parameters. RANDBETWEEN generates a whole number between any two integers you specify. Use RAND when you need a continuous decimal distribution or want to build probability calculations layered on top. Use RANDBETWEEN when you need an integer result within a defined range, which covers most everyday random number needs in spreadsheets.

RAND and RANDBETWEEN are volatile functions, meaning they recalculate every time any cell in the workbook changes, when you press F9, or when the file opens. This is by design. To freeze the result, select the cell, press F9 to show the current value in the formula bar, then press Enter to commit it as a static number. Alternatively, copy the cell and paste special as values only to remove the formula entirely.

Excel has no single native function for unique random integers in a range. The standard approach uses RANK combined with RAND across a helper column, or the RANDARRAY function with the unique parameter in Excel 365. For lists up to 500 unique numbers, an online random number generator with unique mode enabled is faster and requires no formula setup or helper columns.

Use an online generator when you need the result documented with settings recorded, when unique numbers are required without formula complexity, or when the draw needs to be verifiable to other people. An online generator produces a single result with the range and settings visible. An Excel RANDBETWEEN function refreshes invisibly every time the file recalculates, which makes it impossible to audit or reproduce the original result after the fact.

HR

Written by

Hassaan Rasheed

Builder of ToolCenterHub. Passionate about creating fast, privacy-first tools that anyone can use without friction, accounts, or paywalls. Writing about design, development, and the web.

Connect on LinkedIn