Add lines to excel chart

Specific line and bar types are available in 2-D stacked bar and column charts, line charts, pie of pie and bar of pie charts, area charts, and stock charts.

Predefined line and bar types that you can add to a chart

Depending on the chart type that you use, you can add one of the following lines or bars:

  • Series lines    These lines connect the data series in 2-D stacked bar and column charts to emphasize the difference in measurement between each data series. Pie of pie and bar of pie charts display series lines by default to connect the main pie chart with the secondary pie or bar chart. Series Lines

  • Drop lines    Available in 2-D and 3-D area and line charts, these lines extend from data points to the horizontal (category) axis to help clarify where one data marker ends and the next data marker starts. Drop Lines

  • High-low lines    Available in 2-D line charts and displayed by default in stock charts, high-low lines extend from the highest value to the lowest value in each category. High-Low Lines

  • Up-down bars    Useful in line charts with multiple data series, up-down bars indicate the difference between data points in the first data series and the last data series. By default, these bars are also added to stock charts, such as Open-High-Low-Close and Volume-Open-High-Low-Close. Up-Down Bars

Add predefined lines or bars to a chart

  1. Click the 2-D stacked bar, column, line, pie of pie, bar of pie, area, or stock chart to which you want to add lines or bars.

    This displays the Chart Tools, adding the Design, Layout, and Format tabs.

  2. On the Layout tab, in the Analysis group, do one of the following:

    • Click Lines, and then click the line type that you want.

      Note: Different line types are available for different chart types.

    • Click Up/Down Bars, and then click Up/Down Bars. Analysis group on the Layout tab (Chart Tools)

Tip: You can change the format of the series lines, drop lines, high-low lines, or up-down bars that you display in a chart by right-clicking the line or bar, and then clicking Format <line or bar type> .

Remove predefined lines or bars from a chart

  1. Click the 2-D stacked bar, column, line, pie of pie, bar of pie, area, or stock chart that displays predefined lines or bars.

    This displays the Chart Tools, adding the Design, Layout, and Format tabs.

  2. On the Layout tab, in the Analysis group, click Lines or Up/Down Bars, and then click None to remove lines or bars from a chart. Analysis group on the Layout tab (Chart Tools)

Tip: You can also remove lines or bars immediately after you add them to the chart by clicking Undo on the Quick Access Toolbar or by pressing CTRL+Z.

You can add other lines to any data series in an area, bar, column, line, stock, xy (scatter), or bubble chart that is 2-D and not stacked.

Add other lines

  1. This step applies to Word for Mac only: On the View menu, click Print Layout.

  2. In the chart, select the data series that you want to add a line to, and then click the Chart Design tab. 

    Chart Design tab

    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.

  3. Click Add Chart Element, and then click Gridlines.

    Add Chart Element menu

  4. Choose the line option that you want or click More Gridline Options.

    Add gridlines

    Depending on the chart type, some options may not be available.

Remove other lines

  1. This step applies to Word for Mac only: On the View menu, click Print Layout.

  2. Click the chart with the lines, and then click the Chart Design tab.

    Chart Design tab

  3. Click Add Chart Element, click Gridlines, and then click More Gridline Options.

    Add gridlines

  4. Select No line.

    Remove gridlines

    You can also click the line and press DELETE .

Home / Excel Charts / Add a Horizontal Line in a Chart

While creating a chart in Excel, you can use a horizontal line as a target line or an average line. It can help you to compare achievement with the target. Just look at the below chart.

how to add horizontal line to excel chart using best practices

You like it, right? Say “Yes” in the comment section if you like it. OK so listen: Let’s say you have an average value which you want to maintain in your sales throughout the year. Or, a constant target which you want to show in a chart for all the months.

In this case, you can insert a straight horizontal line to present that value. Here’s the thing: This horizontal line can be a dynamic one that will change its value or a line with a fixed value. And in today’s post, I’m going to show you exactly how to do this.

I’m gonna share with you that how you can insert a fixed as well as a dynamic horizontal line in a chart.

An average line plays an important role whenever you have to study some trend lines and the impact of different factors on-trend. And before you create a chart with a horizontal line you need to prepare data for it.

Before I tell you about these steps let me show how I am setting up the data. Here I am using a dynamic chart to show you that how this will help you to make your presentation super cool. (download this dynamic data table from here) to follow along.

Use Data Table To Add Horizontal Line To Excel Chart

In the above data tables, I am getting data from the raw table to the dynamic table by using a VLOOKUP MATCH. Every time when I change the year in the dynamic table it will automatically change the sales values and the average will be calculated on those sale figures.

Below are the steps you need to follow to create a chart with a horizontal line.

  1. First of all, select the data table and insert a column chart.
  2. Go To Insert ➜ Charts ➜ Column Charts ➜ 2D Clustered Column Chart. or you can also use Alt + F1 to insert a chart.
  3. So now, you have a column chart in your worksheet like below.
    insert-a-to-add-horizontal-line-to-excel-chart
  4. Next step is to change that average bars into a horizontal line.
  5. For this, select the average column bar and Go to → Design → Type → Change Chart Type.
    go-to-design-tab-add-horizontal-line-to-excel-chart
  6. Once you click on change chart type option, you’ll get a dialog box for formatting.
  7. Change the chart type of average from “Column Chart” to “Line Chart With Marker”.
    change-chart-type-to-add-horizontal-line-to-excel-chart-1
  8. Click OK.

Here is your ready-to-rock column chart with an average line and make sure to download this sample file from here.

How To Add Horizontal Line To Excel Chart Using Best Practices

One of my colleagues uses this same method to add a median line. You can also use this method to add an average line in a line chart. The steps are totally the same, you just have to insert a line chart instead of a column chart. And you will get something like this.

Add Horizontal Line To Excel Chart In A Line Chart

Add a Horizontal Target Line in Column Chart

This is one more method which I often use in my charts is adding a target line. There are several other ways to create a Target Vs. Achievement chart, but target line method is simple & effective. First of all, let me show you the data which I am using to create a target line in the chart.

add horizontal line to excel chart to present a horizontal line

I have used the above table to get the target and actual figures from the month-wise tables and make sure to download the sample file from here. Now let’s start with the steps.

  1. Select the dynamic table which I have mentioned above.
  2. Insert a column chart. Go To Insert → Charts → Column Charts → 2D Clustered Column Chart.
  3. You’ll get a chart like below.
    add-horizontal-line-to-excel-chart-to-insert-a-target-line
  4. Now, you have to change the chart type of target bar from Column Chart to Line Chart With Markers. To change the chart type please use same steps which I have used in the previous method.
  5. After changing chart type your chart will look something like this.
    add-horizontal-line-to-excel-chart-in-targetline-in-line-chart
  6. Now, we have to make some changes in this line chart.
  7. After that, make a double click on the line to open formatting option. Once you do that, you’ll get a formatting option dialog box.
  8. Make following changes in formatting.
    1. Go to → Fill & Line → Line.
    2. Change line style to “No Line”.

    change-line-type-in-line-chart-to-add-horizontal-line-to-excel-chart

  9. Now, go to marker section and make following changes.
    1. Change marker type to Built-In, a horizontal bar, and size 25.
    2. Marker fill to solid fill.
    3. Use white color as the fill color.
    4. Make border style to a solid color.
    5. And, black color for borders.

    make-changes-add-horizontal-line-to-excel-chart

  10. Once you make all the changes to the line you’ll get a chart like I have below.
    add-horizontal-line-to-excel-chart-with-target-line.gif

Congratulations! your chart is ready.

Sample File

Download this sample file from here to follow along

More Charting Tutorials

Tuesday, September 11, 2018
Peltier Technical Services, Inc., Copyright © 2023, All rights reserved.
 

Add a Horizontal Line to an Excel Chart

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.

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

XY Scatter Chart Without Horizontal Line

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).

XY Scatter Chart With Ugly Horizontal Line

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.

XY Scatter Chart With 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).

Paste Special in the Ribbon

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.

Paste Special as New Series

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.

Column and Line Charts Without Horizontal Lines

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.

Column and Line Charts Without Horizontal Lines

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.

Column Chart With Categories 1-5

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.

Column Chart With Categories 1-5 and Mid Categories

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.

Column Chart With Desired Horizontal Line

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.

Column and Line Chart With Horizontal Line

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

Change Series Chart Type 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.

Change Series Chart Type Dialog

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.

Column and Line Chart With Horizontal Line

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

Change Series Chart Type And Axis Dialog

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

Column and Line Chart With Horizontal Line

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

Column and Line Chart With Horizontal Line

“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.

Column and Line Charts With Lazy Horizontal Lines

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.

Column and Line Charts With Lazy Horizontal Lines

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.

Column and Line Charts With Lazy Horizontal Lines

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.

Area Chart Without Horizontal Line

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.

Area Chart Without Horizontal Line

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.

Area Chart With Horizontal Line

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.

Area Chart With Horizontal Line

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

Area Chart With Lazy Horizontal 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.

Area Chart With Lazy Horizontal Line

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.

Area Chart With Lazy Horizontal Line

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

Area Chart With Horizontal Line

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.

Horizontal Line Behind Columns in an Excel Chart

Historical

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

Target Lines in an Excel Column Chart

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

Add Vertical Line To Excel Bar or Line Chart

There are a few creative ways to add a vertical line to your chart bouncing around the internet. If you have landed on this article, I assume you are looking for an automated solution so you don’t have to manually drag the line(s) you drew on your spreadsheet every month.

Well, you have come to the right place!

In this article, you will learn the best way to add a dynamic vertical line to your bar or line chart. This technique is fairly easy to implement but took a lot of creative thinking to develop (I definitely did not create this technique but it’s been well known among Excel chartists for decades).

In this article, we’ll cover 3 topics:

  1. Embedding Vertical Line Shapes Into A Chart (Simple Method)

  2. Creating A Dynamic Vertical Line In Your Chart (Advanced Method)

  3. Adding Text Labels Above Your Vertical Line

I do have an example Excel file available to download near the end of this article in case you get stuck on a particular step.

Embedding A Vertical Line Shape Into A Chart

This first method is the quick and dirty way to get a vertical line into your chart. I only recommend this method if this is a single-use chart and you will not have to be moving the vertical line around in the future. You’ll learn a more dynamic methodology in the next section of this article.

Create Your Line

First, you will need to draw a line shape on your spreadsheet. You can do this by navigating to the Insert tab and opening the Shapes menu button.

Select the line button and your cursor should change to be in Draw Mode.

Hold down your SHIFT key on the keyboard and click where you want your line to begin and drag downward to add length to your line.

If your line looks a little slanted, you can ensure the width of the line = 0 to force it to be zero (in the Shape Format tab). If you want to change the length of your line, you can hold the SHIFT key down while you adjust to ensure it remains perfectly vertical.

Format Your Line

You’ll likely want to modify the formatting of your line from the default look. There are many formatting options available to you in the Shape Format tab. This contextual Ribbon tab appears when you have the line shape selected.

For chart lines, I typically modify the following line properties:

  • Line Weight: 2.25 — 3.00 pts

  • Dashes: Rounded Dots

  • Shape Outline Color: Medium/Light Grey

Embed Your Line Into The Chart

Now that you have your vertical line looking the way your want, it’s time to add it to your chart.

Many people will just reposition the line on top of the chart and call it a day. This is really poor practice since the line will not reposition if you happen to move or resize your chart. You will also have to remember to select both the chart and the line objects before copying, to capture the entire chart graphic.

You really should embed the vertical line inside your chart so it becomes part of the chart object. This can be done by:

  1. Copy the vertical line shape (CTRL + C)

  2. Select the Chart Object

  3. Paste (Ctrl + V)

Copy/Paste the Vertical Line into the Chart itself to embed it

Reposition Your Line

After you paste the line into your selected Chart object, you should see the line appear inside the chart. You can then proceed to reposition the line with your mouse. Unfortunately, you cannot use the arrow keys on your keyboard to reposition a shape or textbox embedded in a chart object.

For vertical lines, I recommend making the line start on the X-axis and end at the very top of the Plot Area. The Plot Area is the box that gets outlined in your Chart when you click on the white space between your bars.

To update the position of the vertical line in the future, you just need to remember to move the line inside the chart. We’ll discuss a more advanced technique in the next section which will allow you to automate moving the line across your chart.

Creating A Dynamic Vertical Line In Your Chart

If you are looking for a more automated/long-term solution for incorporating a vertical line into your chart, this is going to be the solution for you.

The technique we’ll be using incorporates a single-pointed Scatter Plot (x,y) in combination with your current chart. The single point charted on the Scatter Plot will control the location of the vertical line.

We will then turn on vertical Error Bars (margin of error indicators), repurposing them to visually display a vertical line on the chart.

Now if that explanation went way over your head, don’t worry! I will walk you through each step and show you it’s really not that difficult to set this up.

Chart Starting Point

I’m going to assume you already have your chart created and you are looking to add the vertical line to the pre-existing chart. With this assumption in mind, I’ll forgo walking you through how to create a chart in Excel.

For this example, we’ll use the below chart to start with and we will work to insert a vertical line to separate the Actual months from the Forecast months.

Create A Combo Chart

The vertical line will need to be plotted using a Scatter Plot chart. Chances are you are working with either a Bar Chart or a Line Chart, so we will need to turn your chart into a Combo Chart. Combo Charts can accommodate different charting types within a single Chart object.

Before you can set up a Combo Chart, your chart will need to have an additional chart series that we can plot to. You can add an additional row of temporary data to your chart data and ensure a new chart series is connected to it (through the Select Chart Data dialog box).

Once your chart has the additional chart series added, select the entire chart and navigate to the Chart Design tab in the Excel Ribbon.

Select the Change Chart Type button to launch the Change Chart Type dialog box. Once the dialog box appears, click on the Combo menu item in the left-side pane.

Look for the series you set up to chart the vertical line and ensure its Chart Type designation is changed to Scatter. Also, make sure the Secondary Axis checkbox remains unchecked.

Once you have made your changes, you can click the OK button to finish converting your chart to a Combo Chart.

Create the Scatter Plot Series

Once you have added Scatter Plot capabilities to your chart, you can then begin to set up your x and y coordinates for your vertical line.

Right-click on your chart and go to Select Data.

Ensure the Series Name you designated as a Scatter Plot series is selected and click the Edit button.

You can then begin to link your X and Y coordinates for your series. In this case, you will want the Y value = 0 and your X value to be halfway between the two bars you wish the vertical line to reside. In this example, since our first forecast month is April, the X value will equal 3.5.

You can hardcode your Y value to zero if you’d like (no cell reference) or link it up to a cell reference to visually show the full coordinates in the spreadsheet.

Adding Vertical Error Bars

So how do we turn a single dot on a Scatter Plot into a vertical bar with no dot? Now is time for the creative part!

What we will be adding to the plotted dot is an Error Bar. What is an Error Bar you might be thinking? It is used in statistics to indicate the margin of error for a given value. This allows someone to chart a value but show the audience that the value might be within a range of numbers that are either greater or less than that value.

We can use this margin indicator line to our advantage and setup up the spreadsheet to allow us to draw a vertical line right on the chart. To add an Error Bar you will need to follow the below steps.

  1. Select the Scatter Plot series

  2. Navigate to the Chart Design Ribbon tab

  3. Open the Add Chart Element menu

  4. Open the Error Bars menu

  5. Select More Error Bars Options…

The Format Error Bars Pane should appear on the right-hand side of your Excel application window.

Open the Error Bar Options drop-down menu and ensure the Y Error Bars for your Series is selected.

Change the Direction = Plus and End Style = No Cap.

For the Error Amount, choose Custom and click the Specify Value button. This will open a dialog box where you will need to designate a Positive and Negative value for your Error margin. Since our plotline is already at zero, we only want our margin to be positive. For this reason, you can set the Negative value to 0.

The positive value will determine the length of your line. You will typically want this to be equal to or greater than the largest value in your bar/line chart.

For an even more dynamic solution, I recommend setting up a cell that reads the values from your chart and determines the maximum value. In this example, the cell used has the formula:

=MAX(B20:M20)

If you want to ensure your line ends a little bit higher than your max value, you can add a percentage increase to your formula. Typically adding 5% does the trick for me. This will change your formula to look something like this:

=MAX(B20:M20) * 105%

After you have set up your Custom Error Bar, you should see the line plotted on your chart.

Formatting The Vertical Line

Once your vertical line is created, the last step will be to format your line to your desired look. Here are the format settings I will typically use:

  • Line Weight: 1.5 pts

  • Dashes: Rounded Dots

  • Shape Outline Color: Medium/Light Grey

  • Marker Fill Color: None

  • Marker Border Color: None

After some further format changes to the chart itself, you can have a very professional-looking chart with a vertical line plot directly inside it.

Automating The Vertical Line’s Movement

You may choose to manually update the vertical lines’ X Value every time, but you may also be able to utilize a formula to handle the movement for you.

Let’s look at the article example. The vertical line represents the separation of Actual vs. Forecast Sales results.

Looking at the data table, we can incorporate a simple COUNTIFS function to count how many months are designated as “Actuals”. This way, as the year progresses, the vertical line in the chart will move along as more and more months become “Actuals”.

Depending on your situation, you may be able to come up with a similar sort of formula to automate your vertical line movement as time progresses.

Adding Text Labels Above Your Vertical Line

Now let’s say you want to add a label to your vertical line to give your audience clarity on what it is defining. We can tweak the setup of the vertical line to incorporate the use of a data label.

In order to position a data label at the top of the vertical line, we’ll need to move our plotted dot to the very top of the line.

To do this, you simply need to turn your Max Bound value negative and ensure your Y value has a formula equating to a positive version of your Max Bound value (just multiply by -1).

This will move your plotted dot up to the top and carry your line length down southbound (negative) to end at zero.

After you’ve re-jiggered your vertical line setup, you can then proceed to add a data label. Simply select your plotted dot and right-click on it. Then open the Add Data Labels menu and click Add Data Labels.

You should then see a data label appear next to your vertical line.

Next, you’ll likely want to reposition your data label to be directly over your vertical line. To do this, select and right-click on your data label. Click the Format Data Point menu option and the Format Data Label pane should open up.

In the Label Position section of the Label Options, select Above.

Finally, you’ll want to customize the text that is stored in the label. After selecting the Data Label, you can write a text formula (similar to the screenshot above) or you can link the Data Label to a spreadsheet cell with your desired text value.

The final result should look something like this:

Download Examples In Excel

If you would like to instantly download an Excel file I put together with exact chart examples used in this article along with a few other examples, feel free to click the below download button. No strings attached :)

I Hope This Helped!

Hopefully, I was able to explain how you can add a vertical line to your Excel Charts. If you have any questions about this technique or suggestions on how to improve it, please let me know in the comments section below.

About The Author

Hey there! I’m Chris and I run TheSpreadsheetGuru website in my spare time. By day, I’m actually a finance professional who relies on Microsoft Excel quite heavily in the corporate world. I love taking the things I learn in the “real world” and sharing them with everyone here on this site so that you too can become a spreadsheet guru at your company.

Through my years in the corporate world, I’ve been able to pick up on opportunities to make working with Excel better and have built a variety of Excel add-ins, from inserting tickmark symbols to automating copy/pasting from Excel to PowerPoint. If you’d like to keep up to date with the latest Excel news and directly get emailed the most meaningful Excel tips I’ve learned over the years, you can sign up for my free newsletters. I hope I was able to provide you some value today and hope to see you back here soon! — Chris

Usually, horizontal lines are added to a chart to highlight a target, threshold, limits, base, average, or benchmark. These lines, for example, can help control if a process is behaving differently than usual. Excel allows you to add a vertical line to an existing chart in several different ways, e.g., by calculating line values for a scatter, line, or column chart, but using error bars is the easiest way to add a vertical line to a chart:

Goal as horizontal line in Excel 365

Limits as horizontal line in Excel 365

See how to add a vertical line to the scatter plot, a line or bar chart, or a horizontal line to a chart.

To add a horizontal line to a line or column chart, do the following:

   I.   Add new data for the horizontal line

   1.   Add the cells with the goal or limit (limits) to your data.

For example, cell C16 contains the goal that should be displayed as a horizontal line:

Additional data for the chart in Excel 365

   II.   Add a new data series

   2.   Add a new data series to your chart by doing one of the following:

  • Right-click on the chart plot area and choose Select Data… in the popup menu:

    Select Data in popup menu Excel 365

  • On the Chart Design tab, in the Data group, choose Select Data:

    Select Data in Excel 365

In the Select Data Source dialog box, under Legend Entries (Series), click the Add button, then in the Edit Series dialog box, type:

  • Optionally, in the Series name box, the name of this line (for this example, Goal),
  • In the Series values box, the cell with the goal (for this example, $C$16):

Edit Series in Excel 365

By default, Excel adds the new data series to the first point on the x-axis. Note that a new data series can be invisible (see how to select invisible chart elements):

Simple chart in Excel 365

   III.   Change a data series type

Note: This step is necessary because Excel adds only Y Error bars to the first and last data points. To see the horizontal line, you need to add X Error bars.

   3.   Right-click on any data series and choose Change Series Chart Type… in the popup menu:

Change Series Chart Type in Excel 365

In the Change Chart Type dialog box, choose the Scatter type:

Change Chart Type in Excel 365

Don’t worry about the chart! Repeat step 2 to change the data series:

  1. In the Select Data Source dialog box, select the added data series, then under Legend Entries (Series), click the Edit button.
  2. In the Edit Series dialog box, in the Series X values box, add any cell from the horizontal (category) axis but the first or last one (see the note why).

    For example, $B$8:

    Series X values in Excel 365

You will see the correct data for the same horizontal (category) axis:

New data Series in Excel 365

   IV.   Add the horizontal line

   4.   On the chart, select the new data series (see how to select invisible chart elements), then do one of the following:

  • Click on the Chart Elements button, select the Error Bars list, then choose More Options…:

    Chart Elements - Error Bars in Excel 365

  • On the Chart Design tab, in the Chart Layouts group, click the Add Chart Element dropdown list:

    Add Chart Element button in Excel 365

    In the Add Chart Element dropdown list, choose the Error Bars list, then click More Error Bars Options…:

    More Error Bars Options in Excel 365

See more about other options in Adding Error bars.

   5.   On the Format Error Bars pane for the Horizontal Error bar (see below how to select the Horizontal Error bar), on the Error Bar Options tab:

  • In the Direction group, select Both,
  • In the End Style group, select No Cap,
  • In the Error Amount group, select the Custom option, then click the Specify Value button:

More Error Bars Options in Excel 365

On the Custom Error Bars dialog box, type or select the appropriate value for negative and positive values. For this example:

Custom Error Bars in Excel 365

You can then make any other adjustments to get the expected look.

Note: To select the Horizontal Error bar for some data series, do one of the following:

  • Click the arrow next to Error Bar Options and choose the Series {data series name}: X Error Bars in the dropdown list:

    Error Bar Options in Excel 365

  • On the Chart Format tab, in the Current Selection group, click the arrow of the Chart Elements dropdown list, then select Series {data series name}: X Error Bars for the needed data series:

    Select Error Bars in Excel 365

See also this tip in French:
Comment ajouter une ligne horizontale au graphique.

Понравилась статья? Поделить с друзьями:
  • Add a new language to word
  • Add ins for excel
  • Add a dropdown in excel
  • Add ing to a word
  • Add a comment to a comment in word