Peltier Technical Services, Inc.
 

Excel Chart Add-Ins | Training | Charts and Tutorials | Peltier Tech Blog


Peltier Tech Charts for Excel

 

Books at Amazon.com

 

Add a Horizontal Line to a Column or Line Chart: Error Bar Method.


 

How do you add a nice horizontal line to a column or line chart, to show a target value, or the series average? The method involves adding a new one-point series with an error bar, applying it to the secondary axes, and making the secondary axes disappear.

Use this data to make a column or line chart. The blank cell in the upper left of this range tells Excel that "Value" is the series names, and the dates in the first column are the category (X axis) labels. (I use dates in this example, but you could use any type of category labels.)

[blank]    Value
11/11/02     15
11/10/02     16
 11/9/02     16
 11/8/02     10
 11/7/02     14
 11/6/02      9
 11/5/02     10
 11/4/02      8
 11/3/02      6
 11/2/02      4
 11/1/02      3
10/31/02      3

In a free section of your worksheet, set up a range with X and Y values corresponding to one endpoint of your indicator line, shown below. The X value could be 0 or 1; I have used 1 to place the data point and a corresponding data label to the right of the chart. We will use the secondary X axis for this line, and scale its min and max to 0 and 1. The Y value corresponds to an average or other significant level you want to indicate on the chart.

[blank]    Average
   1         9.5

Select and copy this range, select the chart, and from the Edit menu, choose Paste Special. Select the New Series, Categories in First Column, and Series Names in First Row options. The new series has the same style (Column or Line) as the first series.

Right click on the new series "Average" and select Chart Type from the pop up menu. Choose the XY Scatter type, subtype Scatter, markers without connecting lines. The series changes (I've formatted it as a cross) and secondary axes appear on the chart.

Double click on the marker for the "Average" series. Click on the X Error Bars tab, select the Minus error bar, with a fixed value of 1. Double click on the resulting error bar, and on the Patterns tab, select a color and line style for the horizontal line. Here I've chosen a solid red line.

Now it's time to neaten up the axes. Double click on the secondary X axis, and on the Scale tab, set 0 for Minimum and 1 for Maximum. On the Patterns tab, choose None for Major and Minor Tick Marks and for Tick Mark labels to make the axis disappear.

Select the secondary Y axis and press Delete (or more formally: right click on the chart, choose Chart Options from the Pop Up menu, click on the Axes tab, and uncheck the box for the Secondary Y Axis).

All that may be left is some embellishing of the chart. I removed the legend, added data labels (Show Values option) to the original series, and a data label to the last point of the horizontal line series. Then I colored the label text to match the series color.

VertizontalLine.zip is a zipped workbook that shows this technique and others for reliably placing a vertical or horizontal line on your column or line chart, using a dummy series or a dummy error bar. Here are some related pages on this site:

Add a Horizontal Line to a Column or Line Chart: Series Method.

Add a Vertical Line to a Column or Line Chart: Series Method.

Add a Vertical Line to a Column or Line Chart: Error Bar Method.

 

Page copy protected against web site content infringement by Copyscape

Peltier Tech Charts for Excel


Peltier Technical Services, Inc.

Excel Chart Add-Ins | Training | Charts and Tutorials | PTS Blog

Peltier Technical Services, Inc., Copyright © 2017. All rights reserved.
You may link to this article or portions of it on your site, but copying is prohibited without permission of Peltier Technical Services.

Microsoft Most Valuable Professional

Microsoft Most Valuable Professional

My MVP Profile