To generate random decimal numbers in Excel, use the RAND() or RANDBETWEEN() functions combined with arithmetic operations. This is useful for simulations, sampling, or creating test data with precise decimal ranges. No add-ins or external tools are required — Excel’s built-in functions handle this natively.
What You'll Need
- Microsoft Excel (2010 or later, including Excel for Microsoft 365)
- A blank worksheet or existing data set where you want to insert random decimals
- Basic familiarity with cell references and formula entry
Step-by-Step
- Open Excel and navigate to the worksheet where you want to generate random decimal numbers.
- Click on the first cell where you want the random decimal to appear (e.g., cell A1).
- Enter the formula
=RAND()and press Enter. This generates a random decimal between 0 and 1, accurate to 15 decimal places. - To generate a random decimal between two specific values — for example, between 5.2 and 18.7 — use the formula:
=RAND()*(18.7-5.2)+5.2. Replace 5.2 and 18.7 with your desired minimum and maximum values. - Press Enter to calculate the result. The cell will display a decimal number within your specified range, such as 12.3456789.
- Copy the formula to other cells by selecting the cell with the formula, then dragging the fill handle (small square at the bottom-right corner of the cell) down or across to fill adjacent cells.
- To prevent the values from changing every time the sheet recalculates, copy the cells with the formulas, right-click the same or another range, and choose Copy, then Paste Values (or use Ctrl+Shift+V and select Values on Windows, or Cmd+Shift+V on Mac).
- If you need to round the decimals to a specific number of places (e.g., two decimal places), wrap the formula with ROUND():
=ROUND(RAND()*(18.7-5.2)+5.2,2). The second argument (2) sets the number of decimal places. - For a random decimal between 0 and 100 with exactly three decimal places, use:
=ROUND(RAND()*100,3).
Common Mistakes
- Using
=RANDBETWEEN()alone for decimals — this function only returns whole numbers. You must combine it with division or multiplication to get decimals. - Forgetting to use parentheses correctly in formulas like
=RAND()*10+5versus=RAND()*(10+5). The first gives 5–15; the second gives 0–15. - Not pasting as values when you want static results. Without this step, every edit, sort, or recalculation changes the numbers, which can break your analysis.
- Assuming RAND() can be set to a precision level — it always returns up to 15 decimals. If you need fewer, you must use ROUND().
- Trying to use commas instead of periods in decimal separators in formulas on systems with regional settings using commas as decimal points — this causes #NAME? or #VALUE! errors. Use periods in formulas regardless of system locale.
Tips
- Use F9 to recalculate manually and see new random values without changing anything in the sheet.
- To generate multiple unique random decimals without duplicates, combine RAND() with sorting: generate the values, then sort the column and use the order as a random sequence.
- For reproducible results (e.g., for sharing a dataset), copy and paste as values immediately after generating. Otherwise, others will see different numbers.
- Use named ranges for min/max values to make formulas readable. For example, name cell D1 as "MinValue" and D2 as "MaxValue", then use
=RAND()*(MaxValue-MinValue)+MinValue. - For negative ranges, like -3.5 to 2.1, use the same formula:
=RAND()*(2.1-(-3.5))+(-3.5)or simplify to=RAND()*5.6-3.5. - If you’re generating thousands of random decimals, consider using Excel’s Data Analysis ToolPak (if enabled) for more advanced random sampling tools.
Troubleshooting
- If you see
#NAME?, check that you typedRAND()correctly — misspellings like "Rand" or "RanD" will not work. Excel functions are not case-sensitive, but typos are. - If you see
#VALUE!, you may have entered text instead of numbers in your min/max range. Verify that any referenced cells contain numeric values. - If the formula displays as text instead of calculating, the cell format might be set to Text. Right-click the cell, choose Format Cells, and select Number or General.
- If the decimal places appear truncated (e.g., showing 1.23 instead of 1.23456), increase the column width or adjust number formatting: select the cells, press Ctrl+1, go to Number, and increase Decimal places.
- If the values keep changing and you want them to stay fixed, paste them as values. To do this: select the range, copy (Ctrl+C), then right-click and choose Paste Special > Values.
- If you’re on a Mac and formulas don’t work, ensure you’re using the US keyboard layout for formula entry. Some international keyboards use different symbols for parentheses or decimal points.
Frequently Asked Questions
Can I generate random decimals without using RAND()?
Yes, you can use RANDBETWEEN() with division. For example, to get a random decimal from 0.00 to 1.00 with two decimals, use=RANDBETWEEN(0,100)/100. This gives you 0.00 to 1.00 in steps of 0.01.
Why do my random decimals change every time I open the file?
RAND() recalculates whenever Excel recalculates the worksheet — including when you open, edit, or save the file. To stop this, copy the values and paste them as static numbers using Paste Values.Can I generate random decimals with a specific distribution, like normal or exponential?
RAND() gives uniform distribution. For normal distribution, use the formula=NORM.INV(RAND(),mean,stdev). For example, =NORM.INV(RAND(),50,10) generates decimals centered at 50 with a standard deviation of 10.
Does RAND() work the same on Excel for Mac and Windows?
Yes, the RAND() and RANDBETWEEN() functions behave identically across platforms. Formula syntax, cell references, and recalculation behavior are consistent.How do I generate random decimals between 1 and 1000 with exactly four decimal places?
Use=ROUND(RAND()*999+1,4). This multiplies RAND() by 999 (to get 0–999), adds 1 (to shift to 1–1000), then rounds to four decimals.