Содержание
- ggplot2 error bars : Quick start guide — R software and data visualization
- Add error bars to a bar and line plots
- Prepare the data
- Barplot with error bars
- Line plot with error bars
- Dot plot with mean point and error bars
- Infos
- Error Bars in Excel
- How to add error bars in Excel?
- How to add custom error bars in Excel?
- How to make individual error bars in Excel?
- How to add horizontal error bars in Excel?
- How to make error bars for a specific data series?
- How to modify error bars in Excel?
- How to delete error bars in Excel?
- Add, change, or remove error bars in a chart
- Add or remove error bars
- Review equations for calculating error amounts
- Add, change, or remove errors bars in a chart in Office 2010
- Express errors as a percentage, standard deviation, or standard error
- Express errors as custom values
- Add up/down bars
ggplot2 error bars : Quick start guide — R software and data visualization
This tutorial describes how to create a graph with error bars using R software and ggplot2 package. There are different types of error bars which can be created using the functions below :
- geom_errorbar()
- geom_linerange()
- geom_pointrange()
- geom_crossbar()
- geom_errorbarh()
Add error bars to a bar and line plots
Prepare the data
ToothGrowth data is used. It describes the effect of Vitamin C on tooth growth in Guinea pigs. Three dose levels of Vitamin C (0.5, 1, and 2 mg) with each of two delivery methods [orange juice (OJ) or ascorbic acid (VC)] are used :
- len : Tooth length
- dose : Dose in milligrams (0.5, 1, 2)
- supp : Supplement type (VC or OJ)
In the example below, we’ll plot the mean value of Tooth length in each group. The standard deviation is used to draw the error bars on the graph.
First, the helper function below will be used to calculate the mean and the standard deviation, for the variable of interest, in each group :
Summarize the data :
Barplot with error bars
The function geom_errorbar() can be used to produce the error bars :
Note that, you can chose to keep only the upper error bars
Read more on ggplot2 bar graphs : ggplot2 bar graphs
Line plot with error bars
You can also use the functions geom_pointrange() or geom_linerange() instead of using geom_errorbar()
Read more on ggplot2 line plots : ggplot2 line plots
Dot plot with mean point and error bars
The functions geom_dotplot() and stat_summary() are used :
The mean +/- SD can be added as a crossbar , a error bar or a pointrange :
Read more on ggplot2 dot plots : ggplot2 dot plot
Infos
This analysis has been performed using R software (ver. 3.2.4) and ggplot2 (ver. 2.1.0)
Enjoyed this article? I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Twitter, Facebook or Linked In.
Show me some love with the like buttons below. Thank you and please don’t forget to share and comment below!!
Avez vous aimé cet article? Je vous serais très reconnaissant si vous aidiez à sa diffusion en l’envoyant par courriel à un ami ou en le partageant sur Twitter, Facebook ou Linked In.
Montrez-moi un peu d’amour avec les like ci-dessous . Merci et n’oubliez pas, s’il vous plaît, de partager et de commenter ci-dessous!
Источник
Error Bars in Excel
Excel error bars are graphical representations of data variability. They demonstrate the precision of a measurement. Typically, the bars represent the standard deviation and standard error. They indicate how far the true value is from the determined value.
Error bars on charts provide a more comprehensive view of the data set and allow users to see the data’s margins or errors.
How to add error bars in Excel?
You can add error bars to certain types of charts in Microsoft Excel, such as line charts, bar charts, and scatter charts.
The steps below will assist you in adding error bars to your Excel charts:
- Select your chart by clicking on it.
- Select the Chart Elements option (plus sign).
- Check the Error Bars box and then click the arrow next to it. You will be presented with a list of items that you can include in your chart.
- You can incorporate the following error bars into your chart:
- Standard Error: This value represents the average error for all values in the dataset.
- Percentage: Calculates the percentage error range and amount for each value.
- Standard Deviation: This shows the standard deviation for each value.
How to add custom error bars in Excel?
In most cases, the standard error bars provided by Excel are sufficient. However, if you want to display your own error bars, you can do so as well.
To create custom error bars in Excel, follow these steps:
- Select a location in your chart by clicking anywhere on it. It will make the three chart option icons available.
- Select the plus sign (the Chart Element icon)
- To the right of the ‘Error bars’ option, click the black triangle icon.
- Select ‘More Options’.
- Check the Custom box in the ‘Format Error Bars’ pane and click on ‘Specify Value’ button.
- Enter the positive and negative error values in the Custom Error dialogue box that appears. You can delete the existing value in the field and manually enter the value (without any equal to sign or brackets). In this example, the error bar value is set to 50. Click ok.
How to make individual error bars in Excel?
Follow the below steps to make individual error bars in Excel:
- Perform steps 1 – 5 described above(How to add custom error bars in Excel?).
- Delete the contents of the Positive Error Value box in the Custom Error Bars dialogue box, place the mouse pointer in the box (or click the Collapse Dialog icon next to it), and select a range in your worksheet(C2:C5 in for example).
- Apply the same logic to Negative Error Value. If you don’t want to see negative error bars, enter 0.
- Click the OK button.
How to add horizontal error bars in Excel?
So far, we’ve only seen vertical error bars. Which are the most frequently used in Excel charting (and can be used with column charts, line charts, area charts, scatter charts)
However, horizontal error bars can be added and used. These can be used with both bar charts and scatter charts.
Here’s an example of how we plotted quarterly data into a bar chart.
The method for adding horizontal error bars is the same as the method for adding vertical error bars that we saw in the previous sections.
How to make error bars for a specific data series?
Adding error bars to all data series in a chart can make it appear cluttered and messy. In a combo chart, for example, it is common practice to assign error bars to only one series. This can be accomplished by taking the following steps:
- Select the data series to which you want to add error bars in your chart.
- Select the Chart Elements option.
The following screenshot demonstrates how to create error bars for a data series represented by a line:
As a result, only the Estimated data series that we choose has standard error bars inserted:
How to modify error bars in Excel?
Follow these steps to change the type or appearance of the existing error bars:
- To access the Format Error Bars pane, do one of the following:
- Select Chart Elements > Error Bars > More Options…
- Select Format Error Bars from the context menu by right-clicking the error bars.
- In your chart, double-click the error bars.
- Change the type, direction, and end style of the error bars by going to the Options tab (the last one).
- Go to the Fill & Line tab to modify the color, transparency, width, cap, join, and arrow type (the first one).
How to delete error bars in Excel?
It’s simple to get rid of the error bars. Simply select the error bar you want to delete and press the delete key.
This will delete all the error bars for that series. If you have both horizontal and vertical error bars, you can select only one of them to delete (again by simply selecting and hitting the Delete key).
Источник
Add, change, or remove error bars in a chart
Error bars in charts you create can help you see margins of error and standard deviations at a glance. They can be shown on all data points or data markers in a data series as a standard error amount, a percentage, or a standard deviation. You can set your own values to display the exact error amounts you want. For example, you can show a 10 percent positive and negative error amount in the results of a scientific experiment like this:
You can use error bars in 2-D area, bar, column, line, xy (scatter), and bubble charts. In scatter and bubble charts, you can show error bars for x and y values.
Note: The following procedures apply to Office 2013 and newer versions. Looking for Office 2010 steps?
Add or remove error bars
Click anywhere in the chart.
Click the Chart Elements button next to the chart, and then check the Error Bars box. (Clear the box to remove error bars.)
To change the error amount shown, click the arrow next to Error Bars, and then pick an option.
Pick a predefined error bar option like Standard Error, Percentage or Standard Deviation.
Pick More Options to set your own error bar amounts, and then under Vertical Error Bar or Horizontal Error Bar, choose the options you want. This is also where you can change the direction, end style of the error bars, or create custom error bars.
Note: The direction of the error bars depends on the type of chart you’re using. Scatter charts can show both horizontal and vertical error bars. You can remove either of these error bars by selecting them, and then pressing Delete.
Review equations for calculating error amounts
People often ask how Excel calculates error amounts. Excel uses the following equations to calculate the Standard Error and Standard Deviation amounts that are shown on the chart.
Uses this equation
s = series number
i = point number in series s
m = number of series for point y in chart
n = number of points in each series
yis = data value of series s and the ith point
ny = total number of data values in all series
s = series number
i = point number in series s
m = number of series for point y in chart
n = number of points in each series
yis = data value of series s and the ith point
ny = total number of data values in all series
M = arithmetic mean
Add, change, or remove errors bars in a chart in Office 2010
In Excel, you can display error bars that use a standard error amount, a percentage of the value (5%), or a standard deviation.
Standard Error and Standard Deviation use the following equations to calculate the error amounts that are shown on the chart.
Uses this equation
s = series number
i = point number in series s
m = number of series for point y in chart
n = number of points in each series
yis = data value of series s and the ith point
ny = total number of data values in all series
s = series number
i = point number in series s
m = number of series for point y in chart
n = number of points in each series
yis = data value of series s and the ith point
ny = total number of data values in all series
M = arithmetic mean
On 2-D area, bar, column, line, xy (scatter), or bubble chart, do one of the following:
To add error bars to all data series in the chart, click the chart area.
To add error bars to a selected data point or data series, click the data point or data series that you want, or do the following to select it from a list of chart elements:
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
On the Layout tab, in the Analysis group, click Error Bars.
Do one of the following:
Click a predefined error bar option, such as Error Bars with Standard Error, Error Bars with Percentage, or Error Bars with Standard Deviation.
Click More Error Bar Options, and then under Vertical Error Bars or Horizontal Error Bars, click the display and error amount options that you want to use.
Note: The direction of the error bars depends on the chart type of your chart. For scatter charts, both horizontal and vertical error bars are displayed by default. You can remove either of these error bars by selecting them, and then pressing DELETE.
On a 2-D area, bar, column, line, xy (scatter), or bubble chart, click the error bars, the data point, or the data series that has the error bars that you want to change, or do the following to select them from a list of chart elements:
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
On the Layout tab, in the Analysis group, click Error Bars, and then click More Error Bar Options.
Under Display, click the error bar direction and end style that you want to use.
On a 2-D area, bar, column, line, xy (scatter), or bubble chart, click the error bars, the data point, or the data series that has the error bars that you want to change, or do the following to select them from a list of chart elements:
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
On the Layout tab, in the Analysis group, click Error Bars, and then click More Error Bar Options.
Under Error Amount, do one or more of the following:
To use a different method to determine the error amount, click the method that you want to use, and then specify the error amount.
To use custom values to determine the error amount, click Custom, and then do the following:
Click Specify Value.
In the Positive Error Value and Negative Error Value boxes, specify the worksheet range that you want to use as error amount values, or type the values that you want to use, separated by commas. For example, type 0.4, 0.3, 0.8.
Tip: To specify the worksheet range, you can click the Collapse Dialog button , and then select the data that you want to use in the worksheet. Click the Collapse Dialog button again to return to the dialog box.
Note: In Microsoft Office Word 2007 or Microsoft Office PowerPoint 2007, the Custom Error Bars dialog box may not show the Collapse Dialog button, and you can only type the error amount values that you want to use.
On a 2-D area, bar, column, line, xy (scatter), or bubble chart, click the error bars, the data point, or the data series that has the error bars that you want to remove, or do the following to select them from a list of chart elements:
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
Do one of the following:
On the Layout tab, in the Analysis group, click Error Bars, and then click None.
Tip: You can remove error bars immediately after you add them to the chart by clicking Undo on the Quick Access Toolbar or by pressing CTRL+Z.
Do any of the following:
Express errors as a percentage, standard deviation, or standard error
In the chart, select the data series that you want to add error bars to.
For example, in a line chart, click one of the lines in the chart, and all the data marker of that data series become selected.
On the Chart Design tab, click Add Chart Element.
Point to Error Bars, and then do one of the following:
Apply the standard error, using the following formula:
s = series number
I = point number in series s
m = number of series for point y in chart
n = number of points in each series
y is = data value of series s and the I th point
n y = total number of data values in all series
Apply a percentage of the value for each data point in the data series
Apply a multiple of the standard deviation, using the following formula:
s = series number
I = point number in series s
m = number of series for point y in chart
n = number of points in each series
y is = data value of series s and the I th point
n y = total number of data values in all series
M = arithmetic mean
Express errors as custom values
In the chart, select the data series that you want to add error bars to.
On the Chart Design tab, click Add Chart Element, and then click More Error Bars Options.
In the Format Error Bars pane, on the Error Bar Options tab, under Error Amount, click Custom, and then click Specify Value.
Under Error amount, click Custom, and then click Specify Value.
In the Positive Error Value and Negative Error Value boxes, type the values that you want for each data point, separated by commas (for example, 0.4, 0.3, 0.8), and then click OK.
Note: You can also define error values as a range of cells from the same Excel workbook. To select the range of cells, in the Custom Error Bars dialog box, clear the contents of the Positive Error Value or Negative Error Value box, and then select the range of cells that you want to use.
Add up/down bars
In the chart, select the data series that you want to add up/down bars to.
On the Chart Design tab, click Add Chart Element, point to Up/Down Bars, and then click Up/down Bars.
Depending on the chart type, some options may not be available.
Источник
Error bars in charts you create can help you see margins of error and standard deviations at a glance. They can be shown on all data points or data markers in a data series as a standard error amount, a percentage, or a standard deviation. You can set your own values to display the exact error amounts you want. For example, you can show a 10 percent positive and negative error amount in the results of a scientific experiment like this:
You can use error bars in 2-D area, bar, column, line, xy (scatter), and bubble charts. In scatter and bubble charts, you can show error bars for x and y values.
Note: The following procedures apply to Office 2013 and newer versions. Looking for Office 2010 steps?
Add or remove error bars
-
Click anywhere in the chart.
-
Click the Chart Elements button next to the chart, and then check the Error Bars box. (Clear the box to remove error bars.)
-
To change the error amount shown, click the arrow next to Error Bars, and then pick an option.
-
Pick a predefined error bar option like Standard Error, Percentage or Standard Deviation.
-
Pick More Options to set your own error bar amounts, and then under Vertical Error Bar or Horizontal Error Bar, choose the options you want. This is also where you can change the direction, end style of the error bars, or create custom error bars.
-
Note: The direction of the error bars depends on the type of chart you’re using. Scatter charts can show both horizontal and vertical error bars. You can remove either of these error bars by selecting them, and then pressing Delete.
Review equations for calculating error amounts
People often ask how Excel calculates error amounts. Excel uses the following equations to calculate the Standard Error and Standard Deviation amounts that are shown on the chart.
This option |
Uses this equation |
---|---|
Standard Error |
Where: s = series number i = point number in series s m = number of series for point y in chart n = number of points in each series yis = data value of series s and the ith point ny = total number of data values in all series |
Standard Deviation |
Where: s = series number i = point number in series s m = number of series for point y in chart n = number of points in each series yis = data value of series s and the ith point ny = total number of data values in all series M = arithmetic mean |
Add, change, or remove errors bars in a chart in Office 2010
In Excel, you can display error bars that use a standard error amount, a percentage of the value (5%), or a standard deviation.
Standard Error and Standard Deviation use the following equations to calculate the error amounts that are shown on the chart.
This option |
Uses this equation |
Where |
---|---|---|
Standard Error |
|
s = series number i = point number in series s m = number of series for point y in chart n = number of points in each series yis = data value of series s and the ith point ny = total number of data values in all series |
Standard Deviation |
|
s = series number i = point number in series s m = number of series for point y in chart n = number of points in each series yis = data value of series s and the ith point ny = total number of data values in all series M = arithmetic mean |
-
On 2-D area, bar, column, line, xy (scatter), or bubble chart, do one of the following:
-
To add error bars to all data series in the chart, click the chart area.
-
To add error bars to a selected data point or data series, click the data point or data series that you want, or do the following to select it from a list of chart elements:
-
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
-
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
-
-
-
On the Layout tab, in the Analysis group, click Error Bars.
-
Do one of the following:
-
Click a predefined error bar option, such as Error Bars with Standard Error, Error Bars with Percentage, or Error Bars with Standard Deviation.
-
Click More Error Bar Options, and then under Vertical Error Bars or Horizontal Error Bars, click the display and error amount options that you want to use.
Note: The direction of the error bars depends on the chart type of your chart. For scatter charts, both horizontal and vertical error bars are displayed by default. You can remove either of these error bars by selecting them, and then pressing DELETE.
-
-
On a 2-D area, bar, column, line, xy (scatter), or bubble chart, click the error bars, the data point, or the data series that has the error bars that you want to change, or do the following to select them from a list of chart elements:
-
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
-
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
-
-
On the Layout tab, in the Analysis group, click Error Bars, and then click More Error Bar Options.
-
Under Display, click the error bar direction and end style that you want to use.
-
On a 2-D area, bar, column, line, xy (scatter), or bubble chart, click the error bars, the data point, or the data series that has the error bars that you want to change, or do the following to select them from a list of chart elements:
-
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
-
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
-
-
On the Layout tab, in the Analysis group, click Error Bars, and then click More Error Bar Options.
-
Under Error Amount, do one or more of the following:
-
To use a different method to determine the error amount, click the method that you want to use, and then specify the error amount.
-
To use custom values to determine the error amount, click Custom, and then do the following:
-
Click Specify Value.
-
In the Positive Error Value and Negative Error Value boxes, specify the worksheet range that you want to use as error amount values, or type the values that you want to use, separated by commas. For example, type 0.4, 0.3, 0.8.
Tip: To specify the worksheet range, you can click the Collapse Dialog button , and then select the data that you want to use in the worksheet. Click the Collapse Dialog button again to return to the dialog box.
Note: In Microsoft Office Word 2007 or Microsoft Office PowerPoint 2007, the Custom Error Bars dialog box may not show the Collapse Dialog button, and you can only type the error amount values that you want to use.
-
-
-
On a 2-D area, bar, column, line, xy (scatter), or bubble chart, click the error bars, the data point, or the data series that has the error bars that you want to remove, or do the following to select them from a list of chart elements:
-
Click anywhere in the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
-
On the Format tab, in the Current Selection group, click the arrow next to the Chart Elements box, and then click the chart element that you want.
-
-
Do one of the following:
-
On the Layout tab, in the Analysis group, click Error Bars, and then click None.
-
Press DELETE.
-
Tip: You can remove error bars immediately after you add them to the chart by clicking Undo on the Quick Access Toolbar or by pressing CTRL+Z.
Do any of the following:
Express errors as a percentage, standard deviation, or standard error
-
In the chart, select the data series that you want to add error bars to.
For example, in a line chart, click one of the lines in the chart, and all the data marker of that data series become selected.
-
On the Chart Design tab, click Add Chart Element.
-
Point to Error Bars, and then do one of the following:
Click |
To |
---|---|
Standard Error |
Apply the standard error, using the following formula:
s = series number |
Percentage |
Apply a percentage of the value for each data point in the data series |
Standard Deviation |
Apply a multiple of the standard deviation, using the following formula:
s = series number |
Express errors as custom values
-
In the chart, select the data series that you want to add error bars to.
-
On the Chart Design tab, click Add Chart Element, and then click More Error Bars Options.
-
In the Format Error Bars pane, on the Error Bar Options tab, under Error Amount, click Custom, and then click Specify Value.
-
Under Error amount, click Custom, and then click Specify Value.
-
In the Positive Error Value and Negative Error Value boxes, type the values that you want for each data point, separated by commas (for example, 0.4, 0.3, 0.8), and then click OK.
Note: You can also define error values as a range of cells from the same Excel workbook. To select the range of cells, in the Custom Error Bars dialog box, clear the contents of the Positive Error Value or Negative Error Value box, and then select the range of cells that you want to use.
Add up/down bars
-
In the chart, select the data series that you want to add up/down bars to.
-
On the Chart Design tab, click Add Chart Element, point to Up/Down Bars, and then click Up/down Bars.
Depending on the chart type, some options may not be available.
See Also
Create a chart
Change the chart type of an existing chart
Excel error bars are graphical representations of data variability. They demonstrate the precision of a measurement. Typically, the bars represent the standard deviation and standard error. They indicate how far the true value is from the determined value.
Error bars on charts provide a more comprehensive view of the data set and allow users to see the data’s margins or errors.
How to add error bars in Excel?
You can add error bars to certain types of charts in Microsoft Excel, such as line charts, bar charts, and scatter charts.
The steps below will assist you in adding error bars to your Excel charts:
- Select your chart by clicking on it.
- Select the Chart Elements option (plus sign).
- Check the Error Bars box and then click the arrow next to it. You will be presented with a list of items that you can include in your chart.
- You can incorporate the following error bars into your chart:
- Standard Error: This value represents the average error for all values in the dataset.
- Percentage: Calculates the percentage error range and amount for each value.
- Standard Deviation: This shows the standard deviation for each value.
How to add custom error bars in Excel?
In most cases, the standard error bars provided by Excel are sufficient. However, if you want to display your own error bars, you can do so as well.
To create custom error bars in Excel, follow these steps:
- Select a location in your chart by clicking anywhere on it. It will make the three chart option icons available.
- Select the plus sign (the Chart Element icon)
- To the right of the ‘Error bars’ option, click the black triangle icon.
- Select ‘More Options’.
- Check the Custom box in the ‘Format Error Bars’ pane and click on ‘Specify Value’ button.
- Enter the positive and negative error values in the Custom Error dialogue box that appears. You can delete the existing value in the field and manually enter the value (without any equal to sign or brackets). In this example, the error bar value is set to 50. Click ok.
How to make individual error bars in Excel?
Follow the below steps to make individual error bars in Excel:
- Perform steps 1 – 5 described above(How to add custom error bars in Excel?).
- Delete the contents of the Positive Error Value box in the Custom Error Bars dialogue box, place the mouse pointer in the box (or click the Collapse Dialog icon next to it), and select a range in your worksheet(C2:C5 in for example).
- Apply the same logic to Negative Error Value. If you don’t want to see negative error bars, enter 0.
- Click the OK button.
How to add horizontal error bars in Excel?
So far, we’ve only seen vertical error bars. Which are the most frequently used in Excel charting (and can be used with column charts, line charts, area charts, scatter charts)
However, horizontal error bars can be added and used. These can be used with both bar charts and scatter charts.
Here’s an example of how we plotted quarterly data into a bar chart.
The method for adding horizontal error bars is the same as the method for adding vertical error bars that we saw in the previous sections.
How to make error bars for a specific data series?
Adding error bars to all data series in a chart can make it appear cluttered and messy. In a combo chart, for example, it is common practice to assign error bars to only one series. This can be accomplished by taking the following steps:
- Select the data series to which you want to add error bars in your chart.
- Select the Chart Elements option.
The following screenshot demonstrates how to create error bars for a data series represented by a line:
As a result, only the Estimated data series that we choose has standard error bars inserted:
How to modify error bars in Excel?
Follow these steps to change the type or appearance of the existing error bars:
- To access the Format Error Bars pane, do one of the following:
- Select Chart Elements > Error Bars > More Options…
- Select Format Error Bars from the context menu by right-clicking the error bars.
- In your chart, double-click the error bars.
- Change the type, direction, and end style of the error bars by going to the Options tab (the last one).
- Go to the Fill & Line tab to modify the color, transparency, width, cap, join, and arrow type (the first one).
How to delete error bars in Excel?
It’s simple to get rid of the error bars. Simply select the error bar you want to delete and press the delete key.
This will delete all the error bars for that series. If you have both horizontal and vertical error bars, you can select only one of them to delete (again by simply selecting and hitting the Delete key).
When you represent data in a chart, there can be cases when there is a level of variability with a data point.
For example, you can not (with 100% certainty) predict the temperature of the next 10 days or the stock price of a company in the coming week.
There will always be a level of variability in the data. The final value could be a little higher or lower.
If you have to represent this kind of data, you can use Error Bars in the Charts in Excel.
What are Error Bars?
Error bars are the bars in an Excel chart that would represent the variability of a data point.
This will give you an idea of how accurate is the data point (measurement). It tells you how far the actual can go from the reported value (higher or lower).
For example, in the below chart, I have the sales estimates for the four quarters, and there is an error bar for each of the quarter bar. Each error bar indicates how much less or more the sales can be for each quarter.
The more the variability, the less accurate is the data point in the chart.
I hope this gives you an overview of what is an error bar and how to use an error bar in Excel charts. Now let me show you how to add these error bars in Excel charts.
How to Add Error Bars in Excel Charts
In Excel, you can add error bars in a 2-D line, bar, column or area chart. You can also add it to the XY scatter chart or a bubble chart.
Suppose you have a dataset and the chart (created using this dataset) as shown below and you want to add error bars to this dataset:
Below are the steps to add data bars in Excel (2019/2016/2013):
- Click anywhere in your chart. It will make available the three icons as shown below.
- Click on the plus icon (the Chart Element icon)
- Click on the black triangle icon at the right of ‘Error bars’ option (it appears when you hover the cursor on the ‘Error Bars’ option)
- Choose from the three options (Standard Error, Percentage, or Standard Deviation), or click on ‘More Options’ to get even more options. In this example, I am clicking on Percentage option
The above steps would add the Percentage error bar to all the four columns in the chart.
By default, the value of the percentage error bar is 5%. This means that it will create an error bar that goes a maximum of 5% above and below the current value.
Types of Error Bars in Excel Charts
As you saw in the steps above that there are different types of error bars in Excel.
So let’s go through these one-by-one (and more on these later as well).
‘Standard Error’ Error Bar
This shows the ‘standard error of the mean’ for all values. This error bar tells us how far the mean of the data is likely to be from the true population mean.
This is something you may need if you work with statistical data.
‘Percentage’ Error Bar
This one is simple. It will show the specified percentage variation in each data point.
For example, in our chart above, we added the percentage error bars where the percentage value was 5%. This would mean that if your data point value is 100, the error bar will be from 95 to 105.
‘Standard Deviation’ Error Bar
This shows how close the bar is to the mean of the dataset.
The error bars, in this case, are all in the same position (as shown below). And for each column, you can see how much is the variation from the overall mean of the dataset.
By default, Excel plots these error bars with a value of standard deviation as 1, but you can change this if you want (by going to the More Options and then changing the value in the pane that opens).
‘Fixed Value’ Error Bar
This, as the name suggests, shows the error bars where the error margin is fixed.
For example, in the quarterly sales example, you can specify the error bars to be 100 units. It will then create an error bar where the value can deviate from -100 to +100 units (as shown below).
‘Custom’ Error Bar
In case you want to create your own custom error bars, where you specify the upper and lower limit for each data point, you can do that using the custom error bars option.
You can choose to keep the range the same for all error bars, or can also make individual custom error bars for each data point (example covered later in this tutorial).
This could be useful when you have a different level of variability of each data point. For example, I may be quite confident about sales numbers in Q1 (i.e, low variability) and less confident about sales numbers in Q3 and Q4 (i.e., high variability). In such cases, I can use custom error bars to show the custom variability in each data point.
Now, let’s dive into more into how to add custom error bars in Excel charts.
Adding Custom Error Bars in Excel Charts
Error bars other than the custom error bars (i.e., fixed, percentage, standard deviation, and standard error) are all quite straightforward to apply. You need to just select the option and specify a value (if needed).
Custom error bars need a little more work.
With custom error bars, there could be two scenarios:
- All data point have the same variability
- Every data point has its own variability
Let’s see how to do each of these in Excel
Custom Error Bars – Same Variability for all Data Points
Suppose you have the data set as shown below and a chart associated with this data.
Below are the steps to create custom error bars (where the error value is the same for all data points):
- Click anywhere in your chart. It will make available the three chart option icons.
- Click on the plus icon (the Chart Element icon)
- Click on the black triangle icon at the right of ‘Error bars’ option
- Choose on ‘More Options’
- In the ‘Format Error Bars’ pane, check the Custom option
- Click on the ‘Specify Value’ button.
- In the Custom Error dialog box that opens, enter the positive and negative error value. You can delete the existing value in the field and enter the value manually (without any equal to sign or brackets). In this example, I am using 50 as the error bar value.
- Click OK
This would apply the same custom error bars for each column in the column chart.
Custom Error Bars – Different Variability for all Data Points
In case you want to have different error values for each data point, you need to have these values in a range in Excel and then you can refer to that range.
For example, suppose I have manually calculated the positive and negative error values for each data point (as shown below) and I want these to be the plotted as error bars.
Below are the steps to do this:
- Create a column chart using the sales data
- Click anywhere in your chart. It will make available the three icons as shown below.
- Click on the plus icon (the Chart Element icon)
- Click on the black triangle icon at the right of ‘Error bars’ option
- Choose on ‘More Options’
- In the ‘Format Error Bars’ pane, check the Custom option
- Click on the ‘Specify Value’ button.
- In the Custom Error dialog box that opens, click on the range selector icon for the Positive Error Value and then select the range that has these values (C2:C5 in this example)
- Now, click on the range selector icon for the Negative Error Value and then select the range that has these values (D2:D5 in this example)
- Click OK
The above steps would give you custom error bars for each data point based on the selected values.
Note that each column in the above chart has a different size error bar as these have been specified using the values in the ‘Positive EB’ and ‘Negative EB’ columns in the dataset.
In case you change any of the values later, the chart would automatically update.
Formatting the Error Bars
There are a few things you can do to format and modify the error bars. These include the color, thickness of the bar, and the shape of it.
To format an error bar, right-click on any of the bars and then click on ‘Format Error bars’. This will open the ‘Format Error Bars’ pane on the right.
Below are the things you can format/modify in an error bar:
Color/width of the Error bar
This can be done by selecting the ‘Fill and Line’ option in then changing the color and/or width.
You can also change the dash type in case you want to make your error bar look different than a solid line.
One example where this could be useful is when you want to highlight the error bars and not the data points. In that case, you can make everything else light in color to make the error bars pop-out
Direction/Style of the Error bar
You can choose to show error bars that go both sides of the data point (positive and negative), you can choose to only show the plus or minus error bars.
These options can be changed from the Direction option in the ‘Format Error Bars’ pane.
Another thing you can change is whether you want the end of the bar to have a cap or not. Below is an example where the chart on the left has the cap and one on the right doesn’t
Adding Horizontal Error Bars in Excel Charts
So far, we have seen the vertical error bars. which are the most common in Excel charting (and can be used with column charts, line charts, area charts, scatter charts)
But you can also add and use horizontal error bars. These can be used with bar charts as well as the scatter charts.
Below is an example, where I have plotted the quarterly data into a bar chart.
The method of adding the horizontal error bars is the same as that of vertical error bars that we saw in the sections above.
You can also add horizontal (as well as vertical error bars) to scatter charts or bubble charts. Below is an example where I have plotted the sales and profit values in a scatter chart and have added both vertical and horizontal error bars.
You can also format these error bars (horizontal or vertical) separately. For example, you may want to show a percentage error bar for horizontal error bars and custom error bars for vertical ones.
Adding Error Bars to a Series in a Combo Chart
If you work with combo charts, you can add error bars to any one of the series.
For example, below is an example of a combo chart where I have plotted the sales values as columns and profit as a line chart. And an error bar has only been added to the line chart.
Below are the steps to add error bars to a specific series only:
- Select the series for which you want to add the error bars
- Click on the plus icon (the Chart Element icon)
- Click on the black triangle icon at the right of ‘Error bars’ option
- Choose the error bar that you want to add.
If you want, you can also add error bars to all the series in the chart. Again, follow the same steps where you need to select the series for which you want to add the error bar in the first step.
Note: There is no way to add an error bar only to one specific data point. When you add it to a series, it’s added to all the data points in the chart for that series.
Deleting the Error bars
Deleting the error bars is quite straightforward.
Just select the error bar that you want to delete, and hit the delete key.
When you do this, it will delete all the error bars for that series.
If you have both horizontal and vertical error bars, you can choose to delete only one of these (again by simply selecting and hitting the Delete key).
So this is all that you need to know about adding error bars in Excel.
Hope you found this tutorial useful!
You may also like the following Excel tutorials:
- How to Create a Timeline / Milestone Chart in Excel
- How to Create a Dynamic Chart Range in Excel
- Creating a Pareto Chart in Excel
- Creating an Actual vs Target Chart in Excel
- How to Make a Histogram in Excel
- How to Find Slope in Excel?
Error bars are used in charts to visually show the error that can be expected with that value.
For example, if I plot the forecasted sales value for the next four quarters, I can use error bars to show the expected variability that may happen.
If you’re wondering how it looks like, below is an example where I have a chart that shows the forecasted sales quantity for some items. The error bars show a possible variation of +/- 10%.
You can create these on columns charts, line charts as well as area charts.
In this tutorial, I will show you how to add error bars in Google Sheets charts.
So let’s get started!
Adding Error Bars To a Column Chart in Excel
Suppose you have a dataset as shown below and you want to create a column chart and show error bars on that chart:
The first step is to insert a column chart using this data.
For the purpose of this tutorial, I will be using a column chart (and then show you how to add error bars to this column chart).
Below are the steps to insert a column chart in Google Sheets:
- Select the dataset (including the headers)
- Click the Insert tab
- Click on Chart option (you can also click on the chart icon in the toolbar)
- By default, it would insert a Pie chart. Double click on the chart to open the Chart editor pane (opens in the right side)
- Click on the Chart Type drop-down and select Column Chart
The above steps would insert a column chart that would look at something as shown below.
Now, in this column chart, we need to add error bars.
Below are the steps to add error bars to a chart in Google Sheets:
- Double-click on the chart to open the Chart Editor pane (on the right)
- In the Chart Editor, click on ‘Customize’
- Click on the Series option
- Scroll down and you’ll find the ‘Error bars’ option. Check the option.
- In the Type drop-down, select Percentage
- In the Value field, enter 10
The above steps will give you the error bars on all columns of the chart. where these are located at the top of the column bar.
In this example, we have specified the error bar to cover +/- 10% of each value in the column. These are known as percentage type error bars.
Let’s have a look at all the different types of error bars that are available in Google Sheets charts.
Types of Error Bars in Google Sheets
In Google Sheets, you can three types of error bars.
Percent
This is the type of error bars we have added in the example below.
In this type, you need to specify the percentage value to use when creating the error bars. For example, if you specify 10%, the error bar will show you the upper and lower range of the value (i.e., 90%-110% range of each value).
Constant
As the name suggests, this will show the error bars where the value is fixed.
For example, if I specify the value to be 50, then it will show the error bar range in the +/50 value for each column bar.
In the example below, the error bar shows that the variation can be +/- 50 for each column (no matter what how high/low the value is)
Standard Deviation
Standard Deviation error bars are plotted at the center of the chart (instead of the top of each column as compared to the other two).
You need to specify the standard deviation value and it will be plotted in the chart as shown below (here I have specified the standard deviation value as 0.1)
Note that there is another option – None, which would remove any existing error bar that you already have in the chart in Google Sheets.
Unfortunately, there is no way to format the error bars. For example, if you want to make them a bit thick or change the color of it, you can’t do it. At least not when I am writing this article. While not a huge issue, sometimes it’s a bit hard to see these bars, especially when you print the charts).
Hope you found this tutorial useful!
You may also like the following Google Sheets tutorials:
- How to make a Bar Graph in Google Sheets
- How to Insert Check Box (Tick Box) Symbol in Google Sheets
- How to Create a Drop-Down List in Google Sheets?
- How to Make a Box and Whisker Plot
- How to Make a Histogram in Google Sheets
- Add error bars to a bar and line plots
- Prepare the data
- Barplot with error bars
- Line plot with error bars
- Dot plot with mean point and error bars
- Infos
This tutorial describes how to create a graph with error bars using R software and ggplot2 package. There are different types of error bars which can be created using the functions below :
- geom_errorbar()
- geom_linerange()
- geom_pointrange()
- geom_crossbar()
- geom_errorbarh()
Add error bars to a bar and line plots
Prepare the data
ToothGrowth data is used. It describes the effect of Vitamin C on tooth growth in Guinea pigs. Three dose levels of Vitamin C (0.5, 1, and 2 mg) with each of two delivery methods [orange juice (OJ) or ascorbic acid (VC)] are used :
library(ggplot2)
df <- ToothGrowth
df$dose <- as.factor(df$dose)
head(df)
## len supp dose
## 1 4.2 VC 0.5
## 2 11.5 VC 0.5
## 3 7.3 VC 0.5
## 4 5.8 VC 0.5
## 5 6.4 VC 0.5
## 6 10.0 VC 0.5
- len : Tooth length
- dose : Dose in milligrams (0.5, 1, 2)
- supp : Supplement type (VC or OJ)
In the example below, we’ll plot the mean value of Tooth length in each group. The standard deviation is used to draw the error bars on the graph.
First, the helper function below will be used to calculate the mean and the standard deviation, for the variable of interest, in each group :
#+++++++++++++++++++++++++
# Function to calculate the mean and the standard deviation
# for each group
#+++++++++++++++++++++++++
# data : a data frame
# varname : the name of a column containing the variable
#to be summariezed
# groupnames : vector of column names to be used as
# grouping variables
data_summary <- function(data, varname, groupnames){
require(plyr)
summary_func <- function(x, col){
c(mean = mean(x[[col]], na.rm=TRUE),
sd = sd(x[[col]], na.rm=TRUE))
}
data_sum<-ddply(data, groupnames, .fun=summary_func,
varname)
data_sum <- rename(data_sum, c("mean" = varname))
return(data_sum)
}
Summarize the data :
df2 <- data_summary(ToothGrowth, varname="len",
groupnames=c("supp", "dose"))
# Convert dose to a factor variable
df2$dose=as.factor(df2$dose)
head(df2)
## supp dose len sd
## 1 OJ 0.5 13.23 4.459709
## 2 OJ 1 22.70 3.910953
## 3 OJ 2 26.06 2.655058
## 4 VC 0.5 7.98 2.746634
## 5 VC 1 16.77 2.515309
## 6 VC 2 26.14 4.797731
Barplot with error bars
The function geom_errorbar() can be used to produce the error bars :
library(ggplot2)
# Default bar plot
p<- ggplot(df2, aes(x=dose, y=len, fill=supp)) +
geom_bar(stat="identity", color="black",
position=position_dodge()) +
geom_errorbar(aes(ymin=len-sd, ymax=len+sd), width=.2,
position=position_dodge(.9))
print(p)
# Finished bar plot
p+labs(title="Tooth length per dose", x="Dose (mg)", y = "Length")+
theme_classic() +
scale_fill_manual(values=c('#999999','#E69F00'))
Note that, you can chose to keep only the upper error bars
# Keep only upper error bars
ggplot(df2, aes(x=dose, y=len, fill=supp)) +
geom_bar(stat="identity", color="black", position=position_dodge()) +
geom_errorbar(aes(ymin=len, ymax=len+sd), width=.2,
position=position_dodge(.9))
Read more on ggplot2 bar graphs : ggplot2 bar graphs
Line plot with error bars
# Default line plot
p<- ggplot(df2, aes(x=dose, y=len, group=supp, color=supp)) +
geom_line() +
geom_point()+
geom_errorbar(aes(ymin=len-sd, ymax=len+sd), width=.2,
position=position_dodge(0.05))
print(p)
# Finished line plot
p+labs(title="Tooth length per dose", x="Dose (mg)", y = "Length")+
theme_classic() +
scale_color_manual(values=c('#999999','#E69F00'))
You can also use the functions geom_pointrange() or geom_linerange() instead of using geom_errorbar()
# Use geom_pointrange
ggplot(df2, aes(x=dose, y=len, group=supp, color=supp)) +
geom_pointrange(aes(ymin=len-sd, ymax=len+sd))
# Use geom_line()+geom_pointrange()
ggplot(df2, aes(x=dose, y=len, group=supp, color=supp)) +
geom_line()+
geom_pointrange(aes(ymin=len-sd, ymax=len+sd))
Read more on ggplot2 line plots : ggplot2 line plots
Dot plot with mean point and error bars
The functions geom_dotplot() and stat_summary() are used :
The mean +/- SD can be added as a crossbar , a error bar or a pointrange :
p <- ggplot(df, aes(x=dose, y=len)) +
geom_dotplot(binaxis='y', stackdir='center')
# use geom_crossbar()
p + stat_summary(fun.data="mean_sdl", fun.args = list(mult=1),
geom="crossbar", width=0.5)
# Use geom_errorbar()
p + stat_summary(fun.data=mean_sdl, fun.args = list(mult=1),
geom="errorbar", color="red", width=0.2) +
stat_summary(fun.y=mean, geom="point", color="red")
# Use geom_pointrange()
p + stat_summary(fun.data=mean_sdl, fun.args = list(mult=1),
geom="pointrange", color="red")
Read more on ggplot2 dot plots : ggplot2 dot plot
Infos
This analysis has been performed using R software (ver. 3.2.4) and ggplot2 (ver. 2.1.0)
Enjoyed this article? I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Twitter, Facebook or Linked In.
Show me some love with the like buttons below… Thank you and please don’t forget to share and comment below!!
Avez vous aimé cet article? Je vous serais très reconnaissant si vous aidiez à sa diffusion en l’envoyant par courriel à un ami ou en le partageant sur Twitter, Facebook ou Linked In.
Montrez-moi un peu d’amour avec les like ci-dessous … Merci et n’oubliez pas, s’il vous plaît, de partager et de commenter ci-dessous!
How to Add Error Bars in Excel? (Step by Step)
Below are the steps to add error bars in Excel:
- First, we must select the data and the line graph from the “Insert” tab.
- Next, we will get the following line graph by clicking the line graph.
- We can find the “Error Bars” option under the “Layout” tab under the “Analysis” group. For example, the following screenshot shows the same.
- There are various “Error Bars” options available.
- “Error Bars with Standard Error.” “Standard Error,” i.e., SE, is the standard deviation of a sampling distribution. The magnitude of SE helps give an index of the precision of the estimate of the parameter. The standard error is inversely proportional to the size of the sample. That means that the smaller the sample size, the greater the standard errors.
In the below screenshot, the error bars with standard errors are given. All the data points in the series display the amount of error in the same height for Y error bars and the same width for X error bars.
The below screenshot shows that the straight line is drawn from the minimum of the maximum value, i.e., “Red maple” overlaps with the outermost value of the species “Black maple.” It signifies that the data for one group is not different from the other.
- Error bars with Percentage
It uses the percentage specified in the “Percentage” box to calculate the error amount for each data as a percentage of the value of that particular data point. The Y error bars and X error bars are based on a percentage of the value of the data points and vary in size as per the percentage value. By default, it takes the percentage as 5%.
The default 5% value can be seen from the “More Error Bars Options” given in the screenshot below.
- Error bars with Standard Deviation
“Error Bars with Standard Deviation” is the average difference between the data points and their mean. Usually, a one-point standard deviation is considered while creating the error bars. The standard deviation is used when the data is normally distributed, and the pointers are usually at equal distances.
A line is drawn on the maximum data point, i.e., “Red maple” coincides with the maximum error point of “Black maple.” It signifies that the data for one group is not different from the other.
Table of contents
- How to Add Error Bars in Excel? (Step by Step)
- How to Add Custom Error Bars in Excel?
- Things to Remember
- Recommended Articles
How to Add Custom Error Bars in Excel?
We can also make custom error bars apart from the three error bars, i.e., error bars with standard error, error bars with standard deviation, and error bars with percentage.
The minus display is the error to the lower side of the actual value. So, click on the “minus” tab.
Similar to minus, the plus can also be taken, representing the error to the upper side of the actual value. Therefore, click on the “plus” tab.
We can also visualize the error bars without the cap. For example, in the vertical error bars tab, we need to click or select direction as an end style and no cap.
You can download this Error Bars Excel Template here – Error Bars Excel Template
Things to Remember
- The error bars in Excel are the graphical representation that helps visualize the variability of data given on a two-dimensional framework.
- It helps indicate the estimated error or uncertainty to give a general sense of how accurate a measurement is.
- The accuracy is understood by the marker drawn over the original graph and its data points.
- The Excel error bars display the standard error, standard deviation, or percentage value.
- Error bars are usually by drawing cap-tipped lines extending from the center of the plotted data point.
- The error bars’ length usually helps reveal the uncertainty of a data point.
- Depending on the length of the error bars, we can estimate the error. For example, a short error bar shows that the values are more concentrated, directing that plotted average value is more likely to be reliable. On the other hand, the error bar indicates that the values are more spread out and are less likely to be reliable.
- We can customize error bars through the more error bars option.
- In the case of skewed data, the length on each side of the error bars would be unbalanced.
- The error bars usually run parallel to the quantitative scale axis. Therefore, the error bars can be visualized horizontally or vertically depending on whether the quantitative scale is on the X-axis or the Y-axis.
Recommended Articles
This article has been a guide to Error Bars in Excel. Here, we discuss adding error bars in Excel (standard deviation, percentage error, and custom error bars), practical examples, and a downloadable Excel template. You may learn more about Excel from the following articles: –
- VBA Status Bar
- Status Bar in Excel
- Scroll Bars in Excel
- Slicers in Excel
Reader Interactions
Monday, August 30, 2010
Peltier Technical Services, Inc., Copyright © 2023, All rights reserved.
I’ve written about Excel chart error bars in Error Bars in Excel Charts for Classic Excel and in Error Bars in Excel 2007 Charts for New Excel. Both articles contained instructions for adding custom error bar values for individual points, but judging from the emails I receive, a separate article on custom error bars is needed. You cannot add custom error bar values to a single point in a chart. However, you can individual custom error bar values to all points in a plotted series. You need to put all of the individual error bar values into a range of the worksheet. I usually put these values in the same table as the actual X and Y values
Manually Defining Custom Error Bars
Sample Data and Charts
Suppose we have the following data: X and Y values, plus extra columns with positive and negative error bar values for both X and Y directions. The data is set up so that, for example, cells C2 and D2 have the values for the positive and negative horizontal (X) error bars for the point defined by X and Y values in A2 and B2. Cells E2 and F2 have the values for the positive and negative vertical (Y) error bars for this point. The series is plotted using all the data at once, with X in A2:A6 and Y in B2:6. The error bars are also drawn using all the error bar data at once: C2:C6 and D2:D6 for horizontal and E2:E6 and F2:F6 for vertical.
The chart itself is easy: create an XY chart using the data in columns A and B.
The protocols for adding custom error bars differ between Classic Excel and new Excel. After following the appropriate protocol below, the chart will have custom error bars on each data point, based on the additional columns of data. This chart shows just the Y error bars, to show clearly that each point has custom values different from other points:
This chart shows the X and Y error bars:
Important Note
A single custom error bar value cannot be added to a single data point, and custom error bar values cannot be added to a series of data points one point at a time. If you select a single value for your custom error bars, this single value will be applied to all points in the series. A whole set of custom error bar values can be added to an entire series in one operation. Put your custom values into a range parallel to your X and Y values as I’ve done with this sample data, then use the manual technique or the utility to add all the values to the chart series in one step.
New Excel (2007 and later)
It is harder to apply error bars in Excel 2007 than in earlier versions. There is no convenient tab on the Format Series dialog. The Error Bar tab(s) as well as the tabs for Data Label, Up/Down Bars, High/Low Lines, and other features have been removed to make them more discoverable, at least that’s what we were told. To discover these features in Excel 2007, select the chart and navigate to the Chart Tools > Layout contextual tab. Click on the Error Bars button, and scratch your head while you try to decipher the options. Finally, select the More Error Bars Options at the bottom of the list. X (if it’s an XY chart) and Y error bars with initial constant values of 1 are added to the chart series, with the Y error bars selected, and the Format Error Bars dialog is displayed with the Vertical Error Bars tab showing. (If the chart has more than one series, and you had not specifically selected one series, there is an intermediate dialog asking which series to work with.) This dialog doesn’t look too unfamiliar. But there is no obvious way to switch to the horizontal error bars. We are used to having two tabs, one for the vertical error bars, and also one for the horizontal error bars. Remember that Microsoft made these chart formatting dialogs non-modal, so you can click on objects behind the dialogs. Click on the horizontal error bars to change the dialog. To assign custom values to the error bars, select the horizontal or vertical error bars, and on the Horizontal or Vertical Error Bars tab of the Format Error Bars dialog. Move the dialog so it does not cover the range containing your custom values, then click on the Custom option button, and click on Specify Value. A small child dialog appears with entry boxes for selection of the custom error bar values. (It was easier in 2003, where data entry took place directly on the main dialog, but we’re not talking about productivity today.) By default, each field contains a one element array with the element value equal to one. You can enter another constant value, and you don’t need to type the equals sign or curly brackets; Excel will insert them. More likely you want to select a range. Make sure you delete the entire contents of the entry box before selecting a range, or at least select it all, or Excel will think you meant to enter something like the following, which will lead to an error message. The edit box is so narrow, that you cannot see the entire expression at once, and it will be difficult to find this error.
={1}+Sheet1!$D$2:$D$6
If you want the value to be zero, enter zero. Don’t completely clear an entry box, because Excel will think you simply forgot and it will retain the previous value.
Classic Excel (2003 and earlier)
It’s easy to add error bars in Excel 97 through 2003. Bring up the Format Series dialog, by double clicking on the series, by right clicking on the series and choosing Selected Object, by selecting the series and choosing Selected Data Series from the Format menu, or by selecting the series and clicking the shortcut, Ctrl+1 (numeral one). The dialog has a tab for Y Error Bars, and if it’s an XY data series, there is also a tab for X error bars. To define custom error bars, click in the + or – data entry box (no need to select the Custom option button, Classic Excel does this automatically), then select the range containing the custom error bar values using your mouse. If you need only one value for all of the points, you can select a single cell, or even type the value you want. This seems redundant, given the Fixed Value option, but this way you can use different positive and negative fixed values or a custom range for one direction and a constant for the other. This is what the dialog looks like with ranges used to define the custom error bar values. If you want to leave an error bar off the chart, you can leave the data entry box blank.
Notes
The error bars overwhelm the data. To restore the importance of the data itself, use a lighter color for the error bars. Lighten up the axes while you’re at it. If any custom values are negative, the corresponding error bar will be drawn in the opposite direction: a positive error bar with a negative value will be drawn in the negative direction.
Programmatically Defining Custom Error Bars
The command to add error bars using Excel is:
{Series}.ErrorBar Direction:={xlX or xlY}, Include:=xlBoth, Type:=xlCustom, _
Amount:={positive values}, MinusValues:={negative values}
Values can be a single numerical value, for example, 1, an comma-separated array of numerical values in curly braces, such as {1,2,3,4}, or a range address in R1C1 notation. For values in Sheet1!$G$2:$G$10, enter the address as Sheet1!R2C7:R10C7. Combine both plus and minus in the same command. In Excel 2007, if you don’t want to show a particular error bar, you must enter a value of zero in this command. In 2003, you can enter a null string “”. In Excel 2003, the range address must begin with an equals sign, =Sheet1!R2C7:R10C7; Excel 2007 accepts the address with or without the equals sign. Single values or arrays may be entered with or without the equals sign in either version of Excel.
Error Bar Utility
To make it easier to use error bars in Excel 2007 (and in Classic Excel), I’ve built a small utility, which you can download and use for free. It’s found in ErrorBars.zip. This zip file contains two versions, ErrorBars.xls for Excel 97 through 2003, and ErrorBars.xlam for Excel 2007. Install this utility by following the instructions in Installing an Excel Add-In or in Installing an Add-In in Excel 2007. In Classic Excel, the utility places a new item, Add Error Bars, at the bottom of the chart series context menu. All you have to do is right click on the series and select Add Error Bars. Despite all the assurances from Microsoft that context menus work the same in Excel 2007 as in earlier versions, you cannot add an item to an Excel 2007 chart-related context menu. What I’ve done instead is to add an Error Bars item to the end of each of the three Chart Tools contextual ribbon tabs. I know the new philosophy of Office is to place a command in only one place in the whole user interface. I prefer the old style philosophy, however, which is to place the command in every place it may be relevant. I never know where I may be when I want to use a command, and some people remember different hiding places than I do. Whether in Excel 2007 or in earlier versions, click on the added command, and the utility behaves the same. Up pops a simple dialog with four data entry boxes, for plus and minus Y error bars, and for plus and minus X error bars. If the chart type is not XY, the X error bar entry boxes are disabled. You can select a range or enter a constant into the entry boxes. Leave a box blank to omit the corresponding error bars. I hope that this tutorial and the associated utility will make your life easier when working with error bars in Excel 2007.