Chapter 09 Excel Tutorials Intro Script

advertisement
(Ch.9 Intro) 1
Chapter 9 Excel Tutorial Script















Welcome to Chapter 9, Monte Carlo Simulation Introduction
After completing this tutorial you should have sufficient understanding of Monte Carlo
concepts and Excel capabilities to begin building your own Monte Carlo simulations
applied to a wide range of business problems, including the construction of short-term
profit plans, otherwise referred as “Cost-Volume-Profit” models, covered in Chapter 9 of
the text.
This tutorial will show you how to use Microsoft Excel to develop Monte Carlo
simulations without the use of add-ins or special software, such as @RISK or Crystal
Ball.
Monte Carlo refers to a widely used approach for solving complex problems using
computer algorithms to simulate the variable in a model, for example a CVP model.
Typically an algorithm is developed to model the problem, and then the algorithm is run
many times in order to develop a statistical data set for how the model behaves.
To illustrate this we will use the simple example of tossing a fair coin x times
This process has two outcomes heads or tails, each with a 50% probability
In a million coin tosses, roughly half will be heads and half will be tails
To support this conclusion we can use a simple Monte Carlo simulation
If we were able to develop a spreadsheet with a random number generator resulting in 0
for heads and 1 for tails, and then have the spreadsheet recalculate a million times, you
would see that very close to 50% of the recalculations result in 0 heads and the other 50%
in 1 tails
The basic approach would be to build a spreadsheet with random number generators that
replicate the probabilities in the model. This is the essence of simulation. You are
simulating the output(s) of a model given many replications of possible values for the
variable in your model.
Before we create the coin flip simulation, it is important to understand some of the basics
behind the simulation in Excel
There are two basic approaches used to create Monte Carlo in Excel, the Worksheetbased approach and the VBA-based approach
In this tutorial we will use the Worksheet-based approach because it is generally easier to
implement and it does not require the use or knowledge of the Visual Basic programming
language. The Worksheet-based approach provides a very efficient solution to many
types of problems
In the Worksheet-based approach, you build a compact model of the problem on an Excel
worksheet, typically in a single row and then copy and paste the model as many times as
you wish in order to generate the iterations of the model. For example, if you want to run
the model 10,000 iterations to generate your data set for analysis, you would copy and
paste the row containing your model 10,000 times
Note if you are using the worksheet-based approach there are at least three significant
limitations.
(Ch.9 Intro) 2














First, the current version of Excel has a maximum of 1,048,576 rows per spreadsheet.
Thus your Monte Carlo programs would have practical limitations on the number of
iterations that can be run.
Second, the worksheet-based approach requires reducing the problem to a single
spreadsheet row, or at least to a compact enough group of cells to enable easy replication
of the single instance to the desired number of iterations. Many problems, such as the
examples in this tutorial, are of this nature. However, if you want to analyze a more
complex model, for example, the impact of a few dozen variables on the entire income
statement and balance sheet of a company, the worksheet approach becomes impractical.
Third, the worksheet-based approach consumes considerable system resources, and
therefore may result in system lock-ups or other poor system performance when you need
more than a few thousand iterations of the simulation. For example, multiplying a single
simulation by 20,000 iterations can cause the spreadsheet to bog down significantly.
For these situations in which the spreadsheet approach is inadequate, one can use Excel’s
built-in programming language, Visual Basic for Applications or VBA
Now that you know what approach we will be using in the Monte Carlo simulations, it is
important to understand the RAND() function, which is the most essential building block
of Monte Carlo models in Excel.
The RAND() function is Excel’s random number generator. This 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.
To use the RAND() function, simply enter =RAND() in the spreadsheet cell. Each time
the spreadsheet is updated or recalculated, a new number will be generated. A random
number is 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.
A useful variation of the RAND() function is the RANDBETWEEN() function, 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
an error, you may need to install and load the Analysis ToolPak add-in under Excel Addins.
Now developing your model
The real art in developing Monte Carlo models lies in translating a real-world problem
(such as CVP) into Excel equations. This is a skill you can develop over time. Thus, we
begin this tutorial by looking at different ways you can use Excel to simulate the process
of tossing a coin
Normally we think of coin-tossing in terms of generating “heads” and “tails”. However,
for data analysis we need to translate these outcomes into numerical values, via 0 and 1.
Next you have to figure out how to convert the output generated by running the RAND()
function into the output of tossing a coin. In other words we need to take evenly
distributed randomly generated numbers greater than or equal to 0 and less than 1, and
translate them into two single outcomes, 0 or 1, each with a 50% probability, assuming
that the coin in question is fair
To do this, we could also use the RANDBETWEEN() function.
However, as your model variables increase in complexity, it is important to master the art
of RAND() manipulation. For the coin toss, a simple approach would be
=ROUND(RAND(), 0)
(Ch.9 Intro) 3








Another approach that works equally well is =INT(RAND()*2)
As with many other aspects in Excel, there are different ways to accomplish a certain
objective in Excel
Yet another approach to the same problem, which we will look at is to use a Lookup
Table
We encourage you to explore the various options discussed and to choose the one with
which you are most comfortable. When one approach becomes overly complex, try using
your creative capacity to find a more elegant solution
Having completed this tutorial you should now have sufficient understanding of Monte
Carlo concepts and Excel capabilities to begin building your own Monte Carlo
simulations applied to a wide range of business problems, including the construction of
short-term profit plans, otherwise referred as “Cost-Volume-Profit” models, covered in
Chapter 9 of the text.
If you are overwhelmed at this point do no worry. We have thrown at a lot of
information at you, but we will demonstrate each approach
You have successfully completed Chapter 9, Monte Carlo Simulation, of the Excel
Tutorial Series
Refer to Part two of the Chapter 9 Tutorial for the creation of a Monte Carlo Simulation
Download