Generating a table of random numbers in Excel is quick: type one formula such as =RAND() or =RANDBETWEEN(1,100) into a cell, then drag the fill handle across and down to fill the range you want. Excel recalculates these functions on every edit, so the table changes whenever the sheet recalculates — you can freeze the values in place by copying and pasting as values. Here's the full process, plus the pitfalls to avoid.

What You'll Need

  • A copy of Excel for Windows or Mac, or Excel for the web (the steps below work in all of them, though menu labels can differ slightly by version).
  • Optionally, Excel's Analysis ToolPak add-in if you want the built-in Random Number Generation tool instead of formulas. This is enabled by default in most current versions; if not, enable it via File > Options > Add-ins.

Step-by-Step

  1. Decide which function you need. Use RAND() for decimal numbers between 0 and 1, RANDBETWEEN(bottom, top) for whole numbers in a range (for example =RANDBETWEEN(1,100)), or RANDARRAY(rows, columns) to fill a whole table with a single formula (available in Microsoft 365 and Excel 2021 or later).
  2. Pick the top-left cell of your table. For example, cell A1.
  3. Type the formula and press Enter. For a classic fill-down approach, enter something like =RANDBETWEEN(1,100) in A1.
  4. Fill the formula across and down. Click the cell, then drag the small square fill handle in its bottom-right corner across your desired number of columns and down your desired number of rows. Alternatively, select the whole target range first, type the formula, and press Ctrl+Enter (Cmd+Enter on Mac) to fill every selected cell at once.
  5. Alternative for Microsoft 365 users: in one cell, type =RANDARRAY(10,5,1,100,TRUE) and press Enter. This spills a 10-row by 5-column table of random whole numbers between 1 and 100 automatically — no dragging needed. Set the last argument to FALSE for decimals.
  6. Freeze the numbers if needed. Select the table, press Ctrl+C (Cmd+C on Mac), then right-click the same range and choose Paste Special > Values (or press Ctrl+Alt+V then V, then Enter). The formulas are replaced with fixed numbers that will no longer change.
  7. Format the table if you like. With decimals, use Home > Number Format to reduce the display to a set number of decimal places. To generate random decimals between custom bounds without RANDARRAY, use =RAND()*(max-min)+min, for example =RAND()*50+10 for values between 10 and 60.

Common Mistakes

  • Not realizing the numbers keep changing. RAND, RANDBETWEEN and RANDARRAY are volatile: every edit in the workbook reshuffles them. If you need the table to stay put, paste as values.
  • Reversing the RANDBETWEEN arguments. RANDBETWEEN(100,1) returns a #NUM! error — the smaller number goes first.
  • Expecting unique numbers. These functions can repeat values. If you need a random list with no duplicates, use =SORTBY(SEQUENCE(100), RANDARRAY(100)) to shuffle the numbers 1–100, or take the Random Number Generation tool's sampling option.
  • Blocking a RANDARRAY spill. If any cell in the spill range already contains data, you get a #SPILL! error. Clear the target area first.
  • Typing the parentheses incorrectly. =RAND without () is not a valid formula entry for this function — always include the empty parentheses.

Tips

  • Press F9 to recalculate the sheet manually and get a fresh set of random numbers.
  • For repeatable random data (the same table every time), the Analysis ToolPak's Random Number Generation tool lets you set a starting seed: go to Data > Data Analysis > Random Number Generation, choose Uniform or another distribution, set the number of variables and random numbers, and enter a seed value.
  • Use =ROUND(RAND()*100,0) as a quick way to get random whole numbers 0–100 if RANDBETWEEN feels awkward for your layout.
  • Name your table (Table Design > Table Name) if you plan to reference the random data in other formulas.

Troubleshooting

  • You see #NAME? error: RANDBETWEEN is an Analysis ToolPak function in very old Excel versions — enable the add-in via File > Options > Add-ins. In current versions, check for a typo in the function name.
  • You see #SPILL! error: a RANDARRAY formula cannot expand because something occupies its target range. Delete or move the blocking content, or reduce the array size.
  • RANDARRAY is not recognised: your Excel version predates dynamic arrays. Use the fill-down method with RAND or RANDBETWEEN instead.
  • The numbers never change: calculation is probably set to manual. Go to Formulas > Calculation Options and select Automatic, or press F9 to recalculate once.
  • Paste Special replaced the wrong cells: press Ctrl+Z to undo, then reselect exactly the table range before copying and pasting as values.

Frequently Asked Questions

How do I generate random numbers between two values?

Use RANDBETWEEN(low, high) for whole numbers, or RAND()*(high-low)+low for decimals between the two values.

How do I stop Excel from changing the random numbers?

Copy the table and use Paste Special > Values. The formulas are replaced by their current results, which then stay fixed.

Can I generate random numbers with no duplicates?

Yes — shuffle a sequence: =SORTBY(SEQUENCE(100),RANDARRAY(100)) gives a unique random ordering of 1 to 100 in Microsoft 365.

Is there a difference between RAND and RANDBETWEEN?

RAND returns a decimal from 0 up to (but not including) 1. RANDBETWEEN returns whole numbers between the two bounds you specify, inclusive.

Will the random numbers be the same for everyone who opens the file?

No. Since the functions are volatile, each recalculation — including when someone else opens and edits the workbook — produces new values. Paste as values if the table must be identical for all readers.