RAND function

The RAND function in Excel generates a random decimal number between 0 (inclusive) and 1 (exclusive). Each time the worksheet recalculates, the function produces a new random value.

Syntax

=RAND()

Key Features

  1. No arguments: The RAND function does not take any parameters.
  2. Volatile function: It recalculates every time the workbook is recalculated, such as when you enter new data, press F9, or modify a cell.
  3. Output range: The output is always between 0 and less than 1.

Examples

  1. Generate a random number between 0 and 1:
    =RAND()
    

    Example result: 0.8467

  2. Generate a random number in a specific range: To generate a random number between a and b, use:
    =RAND() * (b - a) + a
    

    Example: For a random number between 10 and 20:

    =RAND() * (20 - 10) + 10
    
  3. Generate a random integer in a specific range: Combine RAND with INT or ROUND:
    =INT(RAND() * (b - a + 1)) + a
    

    Example: For a random integer between 1 and 100:

    =INT(RAND() * 100) + 1
    

Tips

  • If you don’t want RAND to change every time the worksheet recalculates, copy the cell containing RAND and paste it as a value using Ctrl + Alt + V → “Values.”
  • For generating random numbers without decimals directly, consider using the RANDBETWEEN function.
Leave a Reply 0

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