Function · Math
Excel RANDBETWEEN function
The Excel RANDBETWEEN function returns a whole number between two ends, and both ends can come up. The ticket 17 on this page is one pictured draw from 1 through 50.
Syntax =RANDBETWEEN(bottom, top)
=RANDBETWEEN(1,50)Arguments
| Name | Required | What to pass |
|---|---|---|
| bottom | Required | The smallest integer that can be returned. A decimal is truncated. |
| top | Required | The largest integer that can be returned. It is included. It must be greater than or equal to bottom. |
Examples
A door-prize ticket from 1 through 50
=RANDBETWEEN(1,50)Result 17 in this picture
| A | B | |
|---|---|---|
| 1 | Low | 1 |
| 2 | High | 50 |
| 3 | Ticket | 17 |
RANDBETWEEN returns an integer from the low end through the high end. A drawing from 1 through 50 can produce 1, it can produce 50, and it can produce anything in between. The sheet on this page shows 17. That is one legal ticket, frozen so the example can be read. Recalculate and the cell becomes some other integer in that range.
Decimals in the arguments are cut toward zero before the draw. =RANDBETWEEN(1.9,3.9) draws from 1, 2, or 3. Before Excel 2007 this function lived in the Analysis ToolPak and a file could show #NAME? until the add-in was on. Current Excel has it built in. It still will not sit still. Paste values when the prize list has to keep the number you already called.