Crystal Ball - Excell Functions
Crystal Ball - Excell Functions
Some Crystal Ball functions can be used directly from within Excel.
Source: Developer Kit for Crystal Ball 2000 and CB Predictor, Decisioneering Inc., 1999.
Sometimes is it useful to embed some functions directly into a worksheet; for example, to
automatically extract summary statistics and/or percentiles from a simulation. These can be
specially formatted for a user, who does not have to know anything about the CB interface.
All of these functions (and others) can be accessed from the function wizard in Excel, or typed in
like any other Excel function (of course, the CB add-in must be loaded first). In the function wizard,
the CB functions are in the “Crystal Ball” category.
Probability Functions for each of the probability distributions included in CB. See
CB.xxx (distribution parameters)
Distributions list in Table 3.1 (page 88) of Evans & Olson book.
Returns descriptive statistics for the specified forecast cell.
ForeReference must point to a defined forecast cell (if not, #VALUE
is displayed). Index is a number between 1 and 13. Before a
simulation is run, or after resetting, the results are shown as zeroes.
The values of Index return the following values:
1: number of trials
2: mean
3: median
CB.GetForeStatFN 4: mode
(ForeReference, Index) 5: standard deviation
6: variance
Simulation 7: skewness
Results 8: kurtosis
9: coefficient of variability
10: minimum
11: maximum
12: range (max-min)
13: standard error
CB.GetForePercentFN(ForeRefere Returns value of a forecast for a specified percentile (cumulative
nce, Percent) probability). The percentile is a number from 0 to 100.
CB.GetCertaintyFN(ForeReferenc Returns the certainty level (cumulative probability) for a given value
e, Value) of a forecast.
CB.IterationsFN() Returns the number of iterations so far in a simulation run.
CB.GetAssumFN (AssumRef,
Returns information about assumption cells.
Index)
CB.GetAssumPercentFN(AssumR Returns percentile of an assumption cell, based on the assumption
eference, Percent) cell’s distribution. Similar to GetForePercentFN for a forecast cell.
Model CB.GetDecVarFN (DecVarRef,
Returns information about decision variable cells.
Information Index)
CB.GetForeFN (ForeRef, Index) Returns information about forecast cells.
Returns the correlation coefficient between two assumption cells (2nd
CB.GetCorrelationFN(AssumRef,
assumption cell specified by column number and row number, for
Column, Row)
some odd reason).
Crystal Ball
CB.GetVersionFN() Returns CB version information
Information
Crystal Ball can be completely controlled from Visual Basic for Applications (VBA), which resides “behind”
all of the Microsoft Office applications (and some non-Microsoft applications). “Intense” VBA programming
is beyond the scope of this handout, but demonstrating the potential utility is fairly straightforward.
Following the instructions in this handout will allow you to run a simulation from a button, and to generate a
report once the simulation is run. Interested users should consult the CB Developers Manual.
Sub RunSimulation()
CB.ResetND
CB.Simulation 500
End Sub
Sub CreateReport()
CB.CreateRptND CBRptOK
End Sub