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.

Built in since Excel 2007. Also in Excel for the web and Google Sheets.

Syntax =RANDBETWEEN(bottom, top)

RANDBETWEEN
=RANDBETWEEN(1,50)

Arguments

NameRequiredWhat to pass
bottomRequiredThe smallest integer that can be returned. A decimal is truncated.
topRequiredThe 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

=RANDBETWEEN(B1,B2)B3
Ticket
AB
1Low1
2High50
3Ticket17
A picture of the sheet, not a live calculator. The pictured ticket is 17. A live formula changes on every calculation.

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.