RANDBETWEEN function

The RANDBETWEEN function in Excel generates a random integer between two specified numbers (inclusive). It’s a simple and effective way to create random whole numbers within a defined range.


Syntax

=RANDBETWEEN(bottom, top)

Parameters

  1. bottom: The smallest integer in the range.
  2. top: The largest integer in the range.

Key Features

  1. Inclusive Range: Both the bottom and top values are included in the range of possible results.
  2. Dynamic Updates: The function recalculates whenever the worksheet recalculates (e.g., when pressing F9 or entering new data).

Examples

  1. Generate a random integer between 1 and 100:
    =RANDBETWEEN(1, 100)
    
  2. Generate a random integer between -10 and 10:
    =RANDBETWEEN(-10, 10)
    
  3. Generate a random number to simulate a dice roll (1 to 6):
    =RANDBETWEEN(1, 6)
    
  4. Generate a random integer between 100 and 200 for a list of cells: Enter =RANDBETWEEN(100, 200) in one cell, then drag to fill multiple cells.

Tips

  • Prevent Recalculation: To prevent the random number from changing every time the worksheet recalculates, copy the cell and paste it as a value (Ctrl + Alt + V → “Values”).
  • For decimals, use RAND or RANDARRAY functions combined with formulas to adjust the range.
  • Use RANDBETWEEN in combination with other functions for advanced scenarios (e.g., simulating random selections).

Comparison with Other Functions

  • RAND: Generates decimals between 0 and 1.
  • RANDARRAY: Can generate an array of random numbers with more control (e.g., decimals, integers, and range customization).
Leave a Reply 0

Your email address will not be published. Required fields are marked *