Info

Whenever you have actual and forecasted data, it is useful to show error bars above and below the series. The following code adds error bars that extend a fixed 25 units above and below the sales data series:

Sub AddErrorBars()

Dim Ser As Series Dim Trnd As Trendline Dim Cht As Chart

Set Cht = Worksheets("Sheet1").ChartObjects("Chart 2").Chart Set Ser = Cht.SeriesCollection(l)

Ser.ErrorBar Direction:=xlY, Include:=xlBoth, Type:=xlFixedValue, Amount:=25 End Sub

Error bars can be set to be above and/or below the bar and can be a fixed width, a percentage of the data point, a certain number of standard deviations, or a custom formula. In Figure 10.16, the fixed-width error bars show that each year's forecasted sales were within an acceptable error range except for 1987.

Figure 10.16

A myriad of error bar options is available.

Figure 10.16

A myriad of error bar options is available.

0 0

Post a comment