RANDBETWEENformula generates a random integer between the two specified numbers. It is commonly used to simulate random events or generate test data.
- How to use
- Examples of using
RANDBETWEENformula not working?
- Similar formulas to
RANDBETWEEN formula with the syntax shown below, it has 2 required parameters:
- 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.
ExamplesHere are a few example use cases that explain how to use the
RANDBETWEENformula 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.
RANDBETWEENnot working? Here are some common mistakes people make when using the
RANDBETWEENGoogle 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.
The following functions are similar to
RANDBETWEEN or are often used with it in a formula:
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.
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.
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.
The 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.
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 the
placesparameter is not specified, the formula rounds to the nearest integer.
You can learn more about the
RANDBETWEEN Google Sheets function on Google Support.