A common task is to add a horizontal line to an Excel chart. The horizontal line may reference some target value or limit, and adding the horizontal line makes it easy to see where values are above and below this reference value. Seems easy enough, but often the result is less than ideal. This tutorial shows how to add horizontal lines to several common types of Excel chart.

We won’t even talk about trying to draw lines using the items on the Shapes menu. Since they are drawn freehand (or free-mouse), they aren’t positioned accurately. Since they are independent of the chart’s data, they may not move when the data changes. And sometimes they just seem to move whenever they feel like it.

The examples below show how to make combination charts, where an XY-Scatter-type series is added as a horizontal line to another type of chart.

## Add a Horizontal Line to an XY Scatter Chart

An XY Scatter chart is the easiest case. Here is a simple XY chart.

Let’s say we want a horizontal line at Y = 2.5. It should span the chart, starting at X = 0 and ending at X = 6.

This is easy, a line simply connects two points, right?

We set up a dummy range with our initial and final X and Y values (below, to the left of the top chart), copy the range, select the chart, and use Paste Special to add the data to the chart (see below for details on Paste Special).

When the data is first added, the autoscaled X axis changes its maximum from 6 to 8, so the line doesn’t span the entire chart. We have to format the axis and type 6 into the box for Maximum. We probably also want to remove the markers from our horizontal line.

## Paste Special

If you don’t use Paste Special often, it might be hard to find. If you copy a range and use the right click menu on a chart, the only option is a regular Paste, and Excel doesn’t always correctly guess how it should paste the data. So I always use Paste Special.

To find Paste Special, click on the down arrow on the Paste button on the Home tab of Excel’s ribbon. Paste Special is at the bottom of the pop-up menu.

You can also use the Excel 97-2003 menu-based shortcut, which is Alt + E + S (for Edit menu > Paste Special).

The tooltip below Paste Special in the menu indicates that you could also use Ctrl + Alt + V, but this shortcut doesn’t do anything for charts.

When the Paste Special dialog appears, make sure you select these options: Add Cells as a New Series, Y Values in Columns, Series Names in First Row, Categories (X Values) in First Column.

Click OK and the new series will appear in the chart.

## Add a Horizontal Line to a Column or Line Chart

When you add a horizontal line to a chart that is not an XY Scatter chart type, it gets a bit more complicated. Partly it’s complicated because we will be making a combination chart, with columns, lines, or areas for our data along with an XY Scatter type series for the horizontal line. Partly it’s complicated because the category (X) axis of most Excel charts is not a value axis.

As with the XY Scatter chart in the first example, we need to figure out what to use for X and Y values for the line we’re going to add. The Y values are easy, but the X values require a little understanding of how Excel’s category axes work. Since the category axes of column and line charts work the same way, let’s do them together, starting with the following simple column and line charts.

Note in the charts above that the first and last category labels aren’t positioned at the corners of the plot area, but are moved inwards slightly. This is because column and line charts use a default setting of *Between Tick Marks* for the *Axis Position* property. We can change the *Axis Position* to *On Tick Marks*, below, and the first and last category labels line up with the ends of the category axis. The line chart looks okay, but we have cut off the outer halves of the first and last columns.

Let’s focus on a column chart (the line chart works identically), and use category labels of 1 through 5 instead of A through E. Excel doesn’t recognize these categories as numerical values, but we can think of them as labeling the categories with numbers.

Now let’s label the points between the categories. Not only do we have halfway points between the categories (1.5, 2.5, 3.5, 4.5), we also have a half category label below the first category (0.5) and another after the last category (5.5).

If the *Axis Position* property were set to *On Tick Marks*, our horizontal line starts at 1 (the first category number of 1) and ends at 5 (the last category number of 5). This would be wrong for a column chart, but might be acceptable for a line chart.

Here is our desired horizontal line, stretching from 0.5 to 5.5

So let’s use this data and the same approach that we used for the scatter chart, at the beginning of this tutorial.

Copy the range, and paste special as new series. We’ve added another set of columns or another line to the chart.

Right click on the added series, and choose *Change Series Chart Type* from the pop-up menu.

In the Change Chart Type dialog, select the *XY Scatter With Straight Lines And Markers* chart type. We’re using markers to temporarily mark the ends of the line, and we’ll remove the markers later; in general we will change directly to *XY Scatter With Straight Lines*.

The new series don’t line up at all, though, because Excel decided we should plot the scatter series on the secondary axes. We could rescale the secondary axes, then hide them, but that makes a complicated situation even more complicated.

So we need to uncheck the *Secondary Axis* box next to the Scatter series in the Change Chart Type dialog.

And now everything lines up as expected: the markers on the horizontal lines are at the edges of the plot area.

We should remove those markers now, and in the future select the chart type without markers.

### “Lazy” Horizontal Line

You may ask why not make a combination column-line chart, since column charts and line charts use the same axis type. And many charts with horizontal lines use exactly this approach. I call it the “lazy” approach, because it’s easier, but it provides a line that doesn’t extend beyond all the data to the sides of the chart.

Start with your chart data, and add a column of values for the horizontal line. You get a column chart with a second set of columns, or a line chart with a second line.

Change the chart type of the added series to a line chart without markers. Doesn’t look very good for the column chart (left) since the horizontal line ends at the centerlines of the first and last column. You could probably get away with it for the line chart, even though the horizontal line doesn’t extend to the sides of the chart.

If we change the *Axis Position* so the vertical axis crosses *On Tick Marks*, the horizontal lines for both charts span the entire chart width. In the column chart, this comes at the expense of the outer halves of the first and last columns. The line chart looks okay, though.

## Add a Horizontal Line to an Area Chart

As with the previous examples, we need to figure out what to use for X and Y values for the line we’re going to add. The category axis of an area chart works the same as the category axis of a column or line chart, but the default settings are different. Let’s start with the following simple area chart.

Notice that the first and last category labels are aligned with the corners of the plot area and the filled area series extends to the sides of the plot area. This is because the default setting of the *Axis Position* property is *On Tick Marks*. We can change it to *Between Tick Marks*, which makes the area chart look a bit strange.

Below is the data for our horizontal line, which will start at 1 (the first category number of 1) and end at 5 (the last category number of 5), without the half-category cushion at either end. Copy the data, select the chart, and Paste Special to add the data as a new series.

Right click on the added series, and change its chart type to *XY Scatter With Straight Lines And Markers* (again, the markers are temporary). The resulting line extends to the edges of the plotted area, but Excel changed the *Axis Position* to *Between Tick Marks*.

Change the *Axis Position* setting back to *On Tick Marks*, and remove the markers from the line.

### “Lazy” Horizontal Line

In the column chart, and perhaps for the line chart, the “lazy” approach did not give a suitable horizontal line, since the line did not extend to the edges of the plot area. Let’s see how it works for an area chart.

Make a chart with the actual data and the horizontal line data.

Right click on the second series, and change its chart type to a line. Excel changed the *Axis Position* property to *Between Tick Marks*, like it did when we changed the added series above to XY Scatter.

Change the *Axis Position* back to *On Tick Marks*, and the chart is finished.

For the area chart, the appearance of the lazy horizontal line is identical to the more complicated line that uses an XY Scatter series. Since it’s easier and just as good, it’s probably better to use the lazy approach.

## Follow-Up

An alert reader noted in the comments that the line produced by this method is placed in front of the bars, and it might be better to place such reference lines behind the data. I have written a new post describing an approach that does just this: Horizontal Line Behind Columns in an Excel Chart.

## Historical

I showed similar approaches in an old post, Add a Target Line.

## More Combination Chart Articles on the Peltier Tech Blog

- Clustered Column and Line Combination Chart
- Precision Positioning of XY Data Points
- Horizontal Line Behind Columns in an Excel Chart
- Bar-Line (XY) Combination Chart in Excel
- Salary Chart: Plot Markers on Floating Bars
- Fill Under or Between Series in an Excel XY Chart
- Fill Under a Plotted Line: The Standard Normal Curve
- Excel Chart With Colored Quadrant Background

Juan Aguero says

Thank you very much for the tutorial. In Add a Horizontal Line to a Column or Line Chart section, how did you change the horizontal axis from number to text (A,B,C…)

Jon Peltier says

Juan –

To begin with, the range I used to populate the chart had the letters in the first column, and Excel used them for the axis labels. In the middle somewhere I changed the letters to numbers in the worksheet, so the chart showed the numbers instead. Then later I changed the numbers in the sheet back to letters.

Song says

Thank you for the tutorial.

For column chart, I usually add a horizontal line by adding a line chart with trendline, and format the trendline, then it looks like the horizontal line extends to the sides of the chart.

Jon Peltier says

Song –

Thanks for sharing your approach. It’s much easier than dealing with an XY series on top of a column chart. The benefit of the XY series is the actual data points extend to the edges of the chart, so it’s easy to add a label out there.

Jan Carlsson says

Hi Jon,

Is there any way to move the reference line behind the bars, instead of “cutting through” them? I switched the series order, which was the only way I could think of, but it didn’t help. The reason for my request is based on best practice derived from Stephen Few. It might seem like a non-problem, but it does distract the perception of the bars to some extent. (Note – I’m not using the “lazy” ref line solution). Regards // Janne

Jon Peltier says

Hi Janne –

No matter how you change the order of series, or even put the bars on the secondary axis and keep the lines on the primary, the lines always appear in front of the columns.

It’s a complicated workaround, but I can use the border of an area chart series. Area charts are plotted behind all other series. But you need to use a date axis so the sides and baseline of the area chart series are outside the plot area. When I get a chance I’ll write it up here.

Jonny says

Hi Jon,

Do you know how i would be able to make a single cell into a horizontal line for my graph?

I have data which is for a year long (365 cells) and i am trying to make that one cell be a horizontal line for all of that data but I cannot do it. Even when I try to use paste special, it does not work. It is coming up as a tiny dot compared to a line.

Jon Peltier says

Jonny –

You know the expression, “Two Points make a line.” One cell can give you one point, or often just half a point (the Y value). Write a simple link formula so in an adjacent cell (e.g., =C17), so both cells have the value of the cell you want to use; alternatively, off in a vacant area of the worksheet link two cells to this particular cell. Do yourself a favor and also use two cells for the X values, as shown in this article.

This is an example of another saying, “spend five minutes with your data first, or spend five hours with your chart later.”

Jon Peltier says

Janne –

Rather than squeeze a new tutorial into a reply to your comment, I have written a new blog post:

Horizontal Line Behind Columns in an Excel Chart

Chris says

Hi Jon,

How would I be able to add a horizontal line across my chart, from a data point generated by a function, rather than from just integers I enter into the sheet?

Eg. the function take a sum based on the previous cell [sum(220-H5)]

Jon Peltier says

Chris –

If you add the data points for your line and use an XY Scatter type to plot the line, you can use whatever formulas you want. The Y values are easy, and the X values are defined by the X axis scale of the category axis.

David says

How about a horizontal line in an existing scatter plot with two sets of data already charted, and the line represents the current date so that every time it is opened, the line moves to represent the date?

Jon Peltier says

David –

Scatter plots are easy, since the X and Y are just what you see along the axes. So you add a few formulas to determine the X and Y values of the endpoints of your line, then add a series using these cells.

Roger Plant says

I have created both a horizontal line and a vertical line overlaying a chart in Excel. I want to be able to move both lines so the cross hairs lie over a particular point in the chart. How do I do this in Excel VBA?

Mark Barnard says

Mr. Peltier,

Thank you for this tutorial. Very easy to follow and understand. I added my limit line easily.

Is there any way to label my line.

Thank you for the effort you’ve extended in your tutorials. They’re wonderful.

Brett says

Hi, I am trying to do this, but the problem is that my X Axis is not number values, It is dates. I track data across a 6 week period and so of course the dates change every week. I have 5 different charts on one tab, each representing a category. All categories except one have a goal of 95 and the one has a goal of 100. Data appears from week to week above the charts and those data values are found on the Y Axis. Basically I need a goal line to go across all the weeks. Is there any help with this when it is dates?

Kris says

For the section ‘Add a Horizontal Line to a Column or Line Chart’ I am confused at the following section:

“Now let’s label the points between the categories. Not only do we have halfway points between the categories, we also have a half category label below the first category and another after the last category.”

How do you label the points between the categories?

Jon Peltier says

Generally you can’t label the in-between points on the axis. To illustrate the halfway points in this article, I faked it by creating a chart with categories at 0.5, 1.0, 1.5, etc. (instead of 1, 2, 3, etc.) that had blank values for the halfway categories.