power4XL Microsoft Excel Resource Center
Free Macros, Formulas, Functions, Tutorials, Downloads, Add-Ins & More!

Using the "RAND()" function


The "RAND()" function is the most essential building block of Monte Carlo models in Excel.  The function is Excel's native random number generator.  The function returns an evenly distributed random real number greater than or equal to 0 and less than 1.  A new random real number is returned every time the worksheet is calculated.

A useful variation of the RAND() function is the function RANDBETWEEN(), which returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated.  If this function returns the #NAME? error, you may need to install and load the Analysis ToolPak add-in.  For more information on how to do this, see www.AnalysisToolPak.com.

To use the RAND() function, simply enter "=RAND()" in the spreadsheet cell.  Each time the spreadsheet is updated or recalculated a new random number will be generated.

A random number is the the core of each variable in your Monte Carlo model.  The random numbers must be manipulated to yield output consistent with the actual problem being modeled.  This is addressed in the topic "Learning to model the problem".

Prev | Contents | Next

Copyright notice:  This site and all content, including computer code and spreadsheet examples, are copyright 2006 by Fritz Dooley.  License is granted for individual users to download examples and to copy code directly into user's spreadsheets and Visual Basic for Applications files.  Users may not redistribute code in any way.  Providing hyperlinks to this web site is encouraged, but posting code and examples on other web sites is expressly forbidden.  "Microsoft" is a registered trademark of Microsoft Corporation.   Neither this web site nor Fritz Dooley is affiliated with Microsoft Corporation.