CB.GetForeStat

This function calculates the specified statistic for the forecast in the specified cell. You can call this function from either a macro or a worksheet.

Run a simulation before calling this function, or else it returns 0.

Note:

To call this function from a worksheet, use the name CB.GetForeStatFN.

CB.GetForeStatFN only pulls N-1 trials during a recalculation for either a single step or a full simulation, but will reflect full trials at the end of the single step or full simulation since a final recalculation is always performed.

Table 123. CB.GetForeStat Returned Data Type

Returned Value

Returned Data Type

The specified statistic for the forecast.

Variant

Table 124. CB.GetForeStat Parameters

Parameter

VBA Data Type

Value

Description

ForeReference

Variant

In a macro: Range("B3")In a worksheet: B3

Points to the forecast cell for which you want the statistic

Index

Integer

See Table 125.

Calculates the specified statistic for the forecast in the specified cell using the values listed in Table 125

Use the following Index named constant and index values (Table 125) to return forecast statistics for the selected cell.

Table 125. CB.GetForeStat Index Parameter Values — Required, Integer

Named Constant Value

Index Value

Description

cbFstTrials

1

Returns the number of trials

cbFstMean

2

Returns the mean

cbFstMedian

3

Returns the median

cbFstMode

4

Returns the mode

cbFstStdDev

5

Returns the standard deviation

cbFstVariance

6

Returns the variance

cbFstSkewness

7

Returns the skewness

cbFstKurtosis

8

Returns the kurtosis

cbFstCV

9

Returns the coefficient of variability

cbFstRangeMin

10

Returns the range minimum

cbFstRangeMax

11

Returns the range maximum

cbFstRangeWidth

12

Returns the range width

cbFstStdError

13

Returns the standard error

cbFstBaseCase

14

Returns the base case (initial value) of the forecast cell

cbFstCp

50

Returns the Cp for short-term data (or Pp for long-term data)

cbFstCpklower

51

Returns the Cpk-lower for short-term data (or Ppk-lower for long-term data)

cbFstCpkupper

52

Returns the Cpk-upper for short-term data (or Ppk-upper for long-term data)

cbFstCpk

53

Returns the Cpk for short-term data (or Ppk for long-term data)

cbFstCpm

54

Returns the Cpm for short-term data (or Ppm for long-term data)

cbFstZLSL

55

Returns the Z-LSL

cbFstZUSL

56

Returns the Z-USL

cbFstZst

57

Returns the Z-st

cbFstZlt

58

Returns the Z-lt

cbFstpNCbelow

59

Returns the p(N/C)-below LSL

cbFstpNCabove

60

Returns the p(N/C)-above USL

cbFstpNCtotal

61

Returns the p(N/C)-total

cbFstPPMbelow

62

Returns the PPM-below LSL

cbFstPPMabove

63

Returns the PPM-above USL

cbFstPPMtotal

64

Returns the PPM-total

Note:

To use CB.GetForeStat in a worksheet, use the integer value of the Index parameter. The named constant will not work. If no mode is calculated, Index = cbFstMode returns #VALUE.