RANDBETWEEN
TheRANDBETWEEN formula generates a random integer between the two specified numbers. It is commonly used to simulate random events or generate test data.
- How to use
RANDBETWEENformula? - Examples of using
RANDBETWEENformula RANDBETWEENformula not working?- Similar formulas to
RANDBETWEEN
Usage
Use the RANDBETWEEN formula with the syntax shown below, it has 2 required parameters:
=RANDBETWEEN(low, high)- low (required):
The lowest value that can be generated by the formula. Must be an integer. - high (required):
The highest value that can be generated by the formula. Must be an integer.
Examples
Here are a few example use cases that explain how to use theRANDBETWEEN formula in Google Sheets.
Generate a random number for a game
If you are creating a game, you may need to generate random numbers for things like enemy strength or loot drops. RANDBETWEEN can be used to generate a random number within a specified range.
Generate test data
If you need to populate a spreadsheet with test data, you can use RANDBETWEEN to generate random numbers within a specified range.
Simulate a dice roll
If you need to simulate a dice roll for a game or other application, you can use RANDBETWEEN to generate a random number between 1 and the number of sides on the dice.
Common Mistakes
RANDBETWEEN not working? Here are some common mistakes people make when using the RANDBETWEEN Google Sheets Formula:
Incorrect argument type
One or both of the arguments passed to RANDBETWEEN are not numeric values.
Low value higher than high value
The value of the 'low' argument is higher than that of the 'high' argument.
Arguments are not integers
One or both of the arguments passed to RANDBETWEEN are not integers.
Related Formulas
The following functions are similar to RANDBETWEEN or are often used with it in a formula:
-
RANDThe
RANDfunction returns a random number between 0 and 1. This function is often used in combination with other functions to generate random values for simulations, games, or statistical analysis. -
RANDARRAYThe
RANDARRAYformula is used to create an array of random numbers between 0 and 1. The size of the array is determined by the number of rows and columns specified in the formula. -
CEILINGThe
CEILINGfunction returns a number rounded up to the nearest multiple of a specified factor. It is commonly used to round up prices to the nearest dollar or to adjust numbers to fit into specific increments. -
FLOORThe FLOOR formula rounds a given number down to the nearest multiple of a specified factor. It is commonly used when dealing with financial data or when working with time values. The function takes a value and an optional factor as arguments and returns the rounded down value.
-
ROUNDThe
ROUNDformula rounds a number to a specified number of decimal places. It is commonly used to simplify large numbers or to make a number more readable. The formula can round both positive and negative numbers. If theplacesparameter is not specified, the formula rounds to the nearest integer.
Learn More
You can learn more about the RANDBETWEEN Google Sheets function on Google Support.