While developing a spreadsheet in Excel 2003, when forecasting or for other reasons, you may need to generate random numbers in certain cells. While this can be done using a function called RAND and applying a mathematical formula to generate numbers between a given range, a shortcut formula exists called RANDBETWEEN. The syntax:
* Replace LOW with the lowest number you want generated.
* Replace HIGH with the highest number you want generated.
For example, to simulate the roll of a standard six-sided dice:
Note that this formula works with positive and negative LOWs and HIGHs, and it will only generate integer numbers. If you need random numbers involving decimals, either use the RAND function or perform division on the result of the RANDBETWEEN function with the following formula:
* Replace PRECISION with the levels of decimal precision needed (i.e. if you need numbers like 1.1 or 1.8, PRECISION would be 1. For numbers like 1.235 or 1.937, PRECISION would be 3).
For example, if you need random monetary values from $5.00 to $9.00, these can have up to two levels of decimal precision (.00 to .99). Thus, the formula would be:
NOTE: If the RANDBETWEEN formula does not work in your spreadsheet or returns a cell with the result of "#NAME", you need to install the Analysis Toolpak Add-In. After installation, press F2 then ENTER to regenerate all formulas.
Press the "print" button on your browser or select "File" - "Print" to print this tip. Then, return to Microsoft Excel 2003 Functions and Formulas - Generate Random Numbers.
Standard disclaimer applies - Read http://tipsforspreadsheets.com/copyright-disclaim.html.