RANDBETWEEN Function in Microsoft Excel: Syntax, Examples & Troubleshooting
Generate random integers with Excel RANDBETWEEN. Learn inclusive integer bounds, recalculation, reproducible range checks and how to freeze a simulation draw.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: RANDBETWEEN(bottom, top) returns a random integer between the supplied integer limits. Both endpoints are eligible. Its value can change whenever the worksheet recalculates, so a guide cannot promise a particular draw from a nontrivial range.
Syntax and arguments
=RANDBETWEEN(bottom, top)
Both arguments are required. bottom is the smallest integer to return; top is the largest. For clear, portable examples, use numeric integer bounds and keep bottom less than or equal to top. Microsoft’s individual reference does not specify every coercion or fractional-bound edge, so this guide does not infer those rules from a different spreadsheet.
The result is a number, not text. Number formatting changes its presentation without changing the randomly generated integer. A six-sided die model uses 1 and 6; using 0 and 6 would allow seven different integer outcomes.
Worked example: simulated daily demand
Enter 80 in B2 and 120 in B3, with labels “Minimum units” and “Maximum units” in A2:A3.
- Enter
=RANDBETWEEN($B$2,$B$3)in D2. - Copy D2 through D6 for five simulated days.
- Every result is expected to be an integer from 80 through 120, inclusive. There is no single fixed expected sequence.
- Enter
=SUM(D2:D6)in D8. Its expected constraint is 400 through 600 units.
For instance, 92, 110, 80, 103 and 115 would be one admissible illustrative sequence, totaling 500. These numbers are an example of a valid sequence, not observed Excel output and not a prediction of your five cells.
The absolute references keep every copied row on the same limits. Recalculating after editing a separate cell can change the draws and therefore the total. Capture a scenario before discussing its results with someone else.
Second example: deterministic boundary control
=RANDBETWEEN(7,7)
The expected result is 7, since there is only one eligible integer. This is a useful range control and does not establish the distribution of a multi-value draw. For =RANDBETWEEN(-1,1), the allowed results are −1, 0 and 1; there is again no fixed expected output on a given calculation.
For =RANDBETWEEN(1,6), check that the observed result is an integer and at least 1 and at most 6. Repeating the formula does not guarantee that all six possible values appear in a small sample.
Advanced application: scale an integer draw to a price increment
A scenario model needs prices from 10.00 to 12.00 in ten-cent increments. Use:
=RANDBETWEEN(100,120)/10
The allowed outputs are 10.0, 10.1, …, 12.0, a set of 21 possible values. Currency formatting can display two decimal places. This discrete construction is different from generating an arbitrary decimal and merely rounding its display.
If a scenario must remain stable, copy the finished results and use Paste Special → Values in a separate output area. The copied numbers are then a snapshot, while the original formulas remain available for another run. Save the bounds and the date with that snapshot so its assumptions remain auditable. This function exposes no seed argument for reproducing a particular prior random sequence.
Troubleshooting and limitations
- Numbers keep changing: this is documented recalculation behavior, not a faulty cell reference. Freeze an approved scenario as values when appropriate.
- Repeated IDs: random draws can repeat. RANDBETWEEN is not a unique-ID generator and copying it does not perform sampling without replacement.
- Wrong endpoints: verify the underlying values in the two bound cells; a displayed rounded value can conceal a noninteger source.
- Reversed or nonnumeric bounds: correct the inputs before relying on the result. The reviewed reference does not provide an exhaustive error table for those cases.
- Too much apparent precision: dividing by ten defines the allowed step; formatting alone does not constrain the generated values.
Use this function for examples, simulations and sampling designs that tolerate recalculation and repetition. This guide does not establish cryptographic randomness or suitability for secrets, access tokens or regulated draws.
Compatibility and verification
Microsoft’s reference checked on October 17, 2026 lists: Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel 2024 Excel 2024 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2016. This current support list does not establish the first release. The introduction version and last functioning version have not been established from the reviewed documentation. No retirement is asserted.
Example verification: Expected numerical results are independently calculated; text and shape expectations follow the documented contract. These examples have not been tested in Microsoft Excel. No screenshot or native execution is claimed.
Related guides and source
ROUND in Excel | SUM in Excel | SEQUENCE in Excel
- Microsoft RANDBETWEEN reference, retrieved October 17, 2026.