Type =RAND() into a cell and press Enter: Excel returns a random decimal greater than or equal to 0 and less than 1. That is the whole formula — no arguments, no inputs. Everything else in this guide is about controlling that number: producing it across a range of rows, turning it into whole numbers in a range you choose, freezing a set of values so they stop changing, and using it to pick winners or shuffle a list fairly.
What You'll Need
- Excel on Windows, Mac, or Excel for the web. RAND works identically in all of them, and in Google Sheets if you need a cross-check.
- A workbook you can edit. If you are experimenting, use a scratch sheet — RAND overwrites nothing, but the formulas recalculate constantly.
- Familiarity with dragging a fill handle (the small square at the bottom-right of a selected cell) to copy a formula down a column.
- Optional: the
RANDBETWEENandRANDARRAYfunctions if you want integers or a whole block of random values in one go.
Step-by-Step
- Pick an empty cell. Click any empty cell, for example A1 on a blank sheet. Keeping the output separate from your data makes it easier to delete later.
- Type the formula. Enter
=RAND()and press Enter. The cell shows something like 0.73465921 — a decimal with roughly 15 significant digits. RAND takes no arguments, but the empty parentheses are required. - Fill it down. Select the cell, grab the fill handle at the bottom-right corner, and drag down as many rows as you need. Alternatively, copy the cell and paste it into the target range. Each cell receives a different value — Excel never repeats the same result in two cells.
- Produce whole numbers in a range. Wrap it:
=INT(RAND()*100)+1gives an integer from 1 to 100. The general pattern is=INT(RAND()*(max-min+1))+min. For example, a number from 10 to 50 is=INT(RAND()*41)+10. Simpler still,=RANDBETWEEN(10,50)does the same job and is easier to read. - Freeze the values. RAND recalculates every time the sheet recalculates — when you edit any cell, press F9, or reopen the file. To keep a set of numbers permanently, select the cells, press Ctrl+C (Cmd+C on Mac), then right-click and use Paste Special > Values. This replaces the formulas with their current results. You can also disable recalculation temporarily via Formulas > Calculation Options > Manual, but pasting values is more reliable.
- Shuffle a list fairly. Put your names or items in column A. In B1 type
=RAND()and fill it down alongside the list. Select both columns, then use Data > Sort, sorting by column B, smallest to largest (or largest to smallest). The order of column A is now random. Delete column B afterwards. This matters because sorting by RAND is unbiased — every item has an equal chance of landing in any position. - Pick a random winner. Use
=INDEX(A2:A21,RANDBETWEEN(1,20))to pull one entry from a list of 20 names. Each recalculation picks a new name. Press F9 a few times to see it change, then paste the result as a value to record it. - Take a random sample. Add a helper column of
=RAND()next to your data, then sort the whole table by that column and keep the first n rows. This gives a simple random sample without duplicates. For repeated samples on newer Excel versions,=RANDARRAY(rows, columns, min, max, TRUE)fills a block in one formula, where TRUE means whole numbers.
Note on menu labels: Excel's ribbon wording varies slightly between Windows, Mac, and the web version, and between older and newer builds. The formulas themselves are identical. Where a path differs — for example Paste Special — use the right-click menu or the Home tab's Paste dropdown, both of which lead to the same options.
Common Mistakes
- Expecting the numbers to stay put. This is the single biggest surprise. RAND is volatile: any edit anywhere in the workbook forces a new value. If you have written down a result and want it reproducible, paste as values immediately.
- Comparing RAND to 1. RAND can return 0 but never returns exactly 1. So
=INT(RAND()*100)yields 0 to 99, not 1 to 100. Add 1 to shift the range, as shown above. - Assuming every value is equally likely to be drawn twice. Values are independent, so a number appearing once has no effect on the next draw. For a lottery-style pick without repeats, sort by RAND and take the top rows instead of re-rolling the formula.
- Using RAND for security or anything that needs unpredictability. Excel's RAND is a statistical random number generator, not a cryptographic one. It is fine for sampling, shuffling, and simulations; it is not suitable for passwords, tokens, or gambling payouts.
- Sorting a range without the helper column. If you highlight only the names and sort, they get reordered while your RAND column stays put — the pairing breaks. Always select every column of the table before sorting by the random key.
- Retyping
RANDwithout brackets.=RANDalone is treated as a name, not a function call, and returns a #NAME? error in older versions or an unexpected result in newer ones. The parentheses are mandatory.
Tips
- Keep the
=RAND()helper column at the far right of your table so sorting and sampling do not disturb other formulas. - Use
ROUND(RAND()*100,2)when you want two-decimal noise for test data rather than the full float. - Pair RAND with
IFto build simulated scenarios:=IF(RAND()<0.3,"win","lose")models a 30% event. Copy down a few hundred rows and useCOUNTIFto see how often each outcome occurs. - To avoid the recalc problem entirely, build your random list, then immediately paste it as values before entering any other data.
- Freeze a single random value for a test: enter
=RAND(), copy the cell, then use Paste Special > Values on the same cell. - Remember that RANDBETWEEN includes both endpoints, unlike the INT(RAND()...) pattern — a subtle difference that changes the odds at the edges of the range.
Troubleshooting
- My numbers keep changing and I lost the values I needed. They are gone once recalculated. There is no undo for a recalc. Rebuild the list and paste as values this time. Going forward, set the workbook to manual calculation while you work, then switch it back.
- The formula shows as text instead of a result. The cell is likely formatted as Text. Select the cell, set the format to General, then re-enter the formula by double-clicking and pressing Enter.
- Every cell shows the same random value. This happens if the formula was typed as a static number or copied without recalculating. Re-enter it in the first cell and fill down with the fill handle rather than retyping in each cell.
- I get a #NAME? error. Check the spelling and brackets:
RAND(),RANDBETWEEN(min,max). On older workbooks saved in an older format, newer functions like RANDARRAY may not be supported — use RAND and RANDBETWEEN instead. - The shuffle looks biased or a name is duplicated. Verify that every row has its own
=RAND()in the helper column, and that you sorted the whole table together. If only part was sorted, the key and the name became mismatched. - Numbers change while I am typing elsewhere. That is expected behaviour. Switch to manual calculation (Formulas > Calculation Options > Manual) while constructing the sheet, and press F9 to refresh when you actually want new values.
Frequently Asked Questions
Does Excel RAND ever produce exactly 1?
No. It returns a value greater than or equal to 0 and strictly less than 1. For whole numbers from 1 to a maximum, multiply by the maximum and add 1, or use RANDBETWEEN.
How do I stop RAND values from changing?
Copy the cells and paste them back as values (Paste Special > Values). That converts the formulas into fixed numbers. Alternatively, set calculation to Manual while you work.
What is the difference between RAND and RANDBETWEEN?
RAND returns a decimal between 0 and 1. RANDBETWEEN returns a whole number within the minimum and maximum you specify, with both ends included.
Can I pick several winners without repeats?
Yes. Add a RAND helper column, sort the whole table by it, and take the top rows you need. Sorting by a random key gives a random order with no duplicates, which re-rolling RANDBETWEEN cannot guarantee.
Is RAND suitable for generating passwords or security tokens?
No. It is a standard spreadsheet random generator designed for analysis and simulation, not for security. Use a dedicated password manager or security tool for anything that needs real unpredictability.
Why do the values recalculate when I change an unrelated cell?
RAND is a volatile function: Excel re-evaluates it on every recalculation of the workbook, not just when its own cell changes. This is by design and is why freezing values matters when you need a stable result.