
The `RAND` function in Excel is used to generate a random decimal number between 0 and 1. Each time the worksheet is recalculated or when changes are made, it generates a new random number. Here’s how to use the `RAND` function:
Basic Usage
To use the `RAND` function, simply type the following into a cell:
=RAND()
Characteristics:
- No Arguments: The `RAND` function doesn’t require any arguments.
- Continuous Update: The value updates when the worksheet is recalculated. This can be caused by entering new data, pressing F9, or through other recalculations.
Example of Practical Uses
=a + (b-a) * RAND()
- Generate Random Numbers in a Different Range: If you wish to generate a random number between two values, say between a and b, you can use:
For example, to generate a random number between 1 and 10:
=1 + (10-1) * RAND()
=INT(a + (b-a) * RAND())
- Random Integer: Use the `RANDBETWEEN` function for generating random integers, or combine `RAND` with other functions:
For example, to generate a random integer between 1 and 10:
=INT(1 + (10-1) * RAND())
Controlling Recalculation
If you want to stop the `RAND` function from updating every time the worksheet recalculates, you can:
- Copy and Paste Values: Copy the formula’s result and paste it back as a value using “Paste Special.”
- Manual Calculation: Switch the workbook to manual calculation mode via Formulas > Calculation Options > Manual. Press F9 to recalculate manually.
Summary
`RAND` is simple yet powerful, suitable for Monte Carlo simulations, sampling, or whenever random data points are needed. Always remember that it recalculates and changes whenever the worksheet changes or recalculates. So, handle results carefully if fixed values are needed.