To select random numbers in Excel, type =RAND() into a cell to get a decimal between 0 and 1, type =RANDBETWEEN(1,100) to get a whole number in a range, or use =RANDARRAY() to spill a whole block of random values at once. Fill the formula down as far as you need, then copy the results and paste them back as values, because every recalculation reshuffles the numbers. That copy-and-paste-as-values step is the one most people skip, and it is the difference between a stable list and one that changes every time you touch the sheet.

What You'll Need

  • Excel for Microsoft 365, Excel 2021 or later, or Excel for the web. RANDARRAY needs a version that supports dynamic arrays; RAND and RANDBETWEEN work in every version.
  • A workbook you can edit. You do not need an add-in, a template or a macro.
  • Decide in advance whether you need decimals or whole numbers, and the smallest and largest value you want to allow.

Step-by-Step

  1. Pick an empty cell. Click the cell where the random value should appear, for example A2 next to your list of names or products. Leave the first row for headers.
  2. Choose the right function. Use =RAND() for a decimal from 0 up to but not including 1. Use =RANDBETWEEN(bottom, top) for whole numbers, with the lowest and highest values you will accept in place of the arguments. Use =RANDARRAY(rows, columns, min, max, whole_number) when you want a whole table of them in one go.
  3. Type the formula and press Enter. For example =RANDBETWEEN(1,50) gives an integer from 1 to 50 inclusive. To get decimals in a different range, use =RAND()*(b-a)+a with your own low and high values in place of a and b.
  4. Lock a range so it does not reshuffle. If you need the random value to stay put while you change other cells, press F9 in the formula bar to replace the formula with a fixed number, or use the paste-as-values method in the next step. You can also set the calculation mode to Manual, but remember to switch it back.
  5. Fill down the column. Hover over the small square at the bottom-right corner of the cell (the fill handle) until the pointer becomes a plus sign, then drag down, or double-click it to fill to the end of the adjacent list. Each row recalculates to a different value. With RANDARRAY, simply enter the formula once with the row and column counts you need and it spills into the neighbouring cells; if those cells are not empty you will get a #SPILL! error, so clear them first.
  6. Convert formulas to fixed values. Select the random cells, press Ctrl+C (Cmd+C on Mac), then right-click the same selection and choose Paste Special > Values, or use the Paste Options button that appears and pick Values. The numbers now stay the same no matter what else changes in the workbook.
  7. Build a random order for a list. Add a column of =RAND() values beside your names, select the whole table including that column, then go to Data > Sort and sort by the random column, smallest to largest. The names are now in a random sequence you can use for a draw, a call order or a sample. Copy and paste the sorted names as values if you need them to stay in that order.
  8. Check the output. Confirm the smallest and largest values are inside the limits you set and that you have exactly as many values as rows you filled. If you used RANDBETWEEN, remember it can legitimately repeat the same number twice.

Common Mistakes

  • Forgetting to paste as values. Any edit to the sheet, or reopening it, recalculates every formula, so a draw you recorded from the screen will no longer match when you look again. Convert to values before you share or print the result.
  • Expecting no repeats. RAND and RANDBETWEEN have no memory, so the same value can appear twice in a column. That is correct behaviour, not a bug. If you need unique values, generate a helper column of random decimals, sort by it, and take the first N rows.
  • Wrong argument order in RANDBETWEEN. The smaller number goes first. =RANDBETWEEN(50,1) returns a #NUM! error.
  • Sorting only part of the table. If you sort the random column without selecting the names beside it, only the numbers move and your list is scrambled relative to the labels. Select the entire table before sorting.
  • Using RAND where whole numbers are needed. A decimal such as 0.4371 is fine for sorting but useless as a dice roll. Round it with ROUND or switch to RANDBETWEEN.
  • Assuming the numbers are secure. These functions are fine for games, sampling and shuffling, but they are not suitable for passwords, encryption keys or anything where unpredictability matters. Use a dedicated random-number tool for those.

Tips

  • Press F9 to force a recalculation and draw a fresh set of numbers without editing anything. In Excel for the web the recalc happens automatically when you enter a formula, so use the F9 shortcut in the desktop app if you want to reroll on demand.
  • If you only want a random sample of rows, generate =RAND() beside every row, sort ascending, and keep the top however many you need. This avoids duplicates entirely because each row has a unique sort key.
  • To prevent a single cell from reshuffling while the rest of the sheet updates, convert just that cell to a value. Selectively pasting values gives you as much stability as you need without freezing the whole workbook.
  • Wrap RANDBETWEEN in CHOOSE or INDEX to pick random names from a list: put your list in a range, then use =INDEX(A2:A20, RANDBETWEEN(1,19)) to pull one at random.
  • Keep a dated copy of any result you report. Because recalculation is invisible until it happens, a saved snapshot is the only proof of what the draw produced.

Troubleshooting

Every number changed after you edited another cell. That is normal recalculation. Undo with Ctrl+Z if the change was recent, or regenerate and immediately paste as values. Setting the workbook to manual calculation under Formulas > Calculation Options stops the constant reshuffling, but remember that other formulas also stop updating until you press F9.

You see #SPILL! after RANDARRAY. Something is blocking the cells the array wants to fill. Clear the cells below and to the right of the formula, then press Enter again.

You see #NUM! with RANDBETWEEN. The bottom value is larger than the top value. Swap them.

You see #NAME?. The function name is misspelled or your version of Excel does not recognise it. RANDARRAY is the usual culprit on older versions; fall back to RAND or RANDBETWEEN filled down manually.

The same numbers keep appearing. If the values look identical across a whole column, you probably copied the formula as text or the column is set to show limited decimal places. Widen the column or format it to show more decimals to confirm they really differ.

Nothing updates when you press F9. Check Formulas > Calculation Options and make sure it is not set to Manual, and confirm the cell still contains a formula rather than a pasted value.

Frequently Asked Questions

What formula gives a random whole number between two values?

=RANDBETWEEN(low, high), with the low value first and the high value second. Both ends are included in the possible results.

How do I stop Excel from changing my random numbers?

Copy the cells, then use Paste Special > Values over the same range. The formulas are replaced by fixed numbers that no longer recalculate.

Can I get random numbers without duplicates?

Not directly. Generate a column of =RAND() values beside your rows, sort by that column, and take the number of rows you need. Each row's sort key is unique, so you never get a repeat.

Why is RANDBETWEEN returning the same number twice?

Because each cell draws independently and repeats are allowed. If you need all values to be different, use the sort-by-random-decimal method instead.

What is the difference between RAND and RANDBETWEEN?

RAND returns a decimal from 0 up to but not including 1. RANDBETWEEN returns a whole number within limits you choose.

Are Excel's random numbers suitable for security use?

No. They are fine for draws, sampling and games, but they are not designed to be unpredictable enough for passwords or encryption.