How to Use the RAND function to generate random values in Excel
To generate randomized values Excel provides the RAND function. This function returns a random number greater than or equal to 0 and less than 1. Each time the worksheet is calculated, a new random number is generated. This example generates randomized integer values from 1 to 999 in cells A2:D10 and then replaces the formulas with calculated values.
How to generate integer random values:
- Select cells A2:D10 and type the following formula: =INT(RAND()*1000).
- Press Ctrl+Enter.
- Press Ctrl+C to copy the filled cells.
- From the Edit menu, select Paste Special.
- In the Paste Special dialog box, select Values under Paste to paste only the values.
- Click OK.
- Press F9 to recalculate the worksheet.
This tip is compatible with Excel 97, 2000, 2003 and 2007.
