3 Ways To Add Vertical Line in Excel Graph

If you want to learn how to add a vertical line to an Excel graph, follow along with the methods and their steps outlined here.

Imagine you are presenting a sales report. You want to highlight a pivotal moment, like the exact date a marketing campaign launched. Without a clear marker, your audience might miss that important context.

Adding a vertical line to an Excel graph can solve this problem.

It draws attention to the key moment and ensures your data tells the right story. However, figuring out how to add this line in Excel can be challenging. Don’t worry! In this tutorial, I’ll guide you step-by-step. It’ll make it easy to highlight your data effectively. Let’s get started!

Using the Insert Shapes Tool

Unfortunately, Microsoft Excel doesn’t come with a built-in tool to add a vertical line in an Excel graph, as other chart element tools, like Axis Titles, Chart Title, Data Labels, etc.

If you occasionally need to insert a vertical line in a chart, you can use the Shapes tool. Though it’s a manual method, it’s the fastest and most effortless way too.

Shapes Lines
Shapes Lines

Firstly, navigate to the worksheet containing the Excel chart where you wish to add a vertical line.

Click on the Insert menu in the Excel ribbon and then click on the Shapes drop-down arrow in the Ikllustratioons block of the Insert tab.

Select the Line object from the Lines menu in the Shapes drop-down menu.

Draw the Shape
Draw the Shape

The mouse cursor will change into a crosshair. It means you can now draw the selected shape on the Excel graph.

Go to the column in the source Excel chart on which you wish to draw the vertical line.

Draw the line by clicking anywhere on the chart area and dragging the mouse down to span the entire column you wish to highlight using the vertical line.

Format Shape Object
Format Shape Object

Click on the line you have just drawn, right-click, and select the Format Object option from the context menu.

Format Shape dialog
Format Shape dialog

The Format Shape navigation panel will show up on the right side of the Excel desktop app.

Click on the Color drop-down menu and choose a color different than the columns of the source Excel chart. This will help the reviewers easily distinguish the vertical line from the columns.

Width formatting
Width formatting

Now, again click on the manually drawn vertical line and increase its width by entering 1.0 pt in the Width field in the Format Shape navigation panel.

Rectangles
Rectangles

To define this vertical line with data points, again go to the Insert tab, and click on the Illustrations drop-down menu or the Shapes command if you don’t see the Illustrations menu.

The list of Shapes will open. Select a shape from the list.

Draw a shape
Draw a shape

Now, draw the shape on the Excel chart, nearer to the vertical line. Double-click to get the typing cursor. You can now enter the values you want to show beside the vertical line.

That’s it! You’ve successfully learned how to insert a vertical line in an Excel graph using the manual object drawing tool, Shapes.

Add a Vertical Line to a Scatter Plot

The previous method isn’t suitable if you wish to dynamically change the position of the vertical line when the chart data changes. To automate the process, you can add a different Series in the existing chart, which will be one-point data, like the averages of the X and Y axis values.

Sample dataset 1

Let’s say, you wish to add a vertical line in the above scatter plot. The vertical line will indicate a point in the chart that is average for the X-axis values and the Y-axis values.

First, calculate the average of X and Y axis values in two different cells as shown in the above screenshot. For example, the X-axis average is in E2 and the Y-axis average is in F2.

Select Data
Select Data

Now, select the existing chart, right-click, and choose the Select Data option from the context menu.

Select Data Source
Select Data Source

The Select Data Source dialog box will open. Click on the Add button just below the Legend Entries (Series) column.

Edit Series
Edit Series

This will bring up the Edit Series dialog box.

Type in a name for the new series into the Series name field. For example, Vertical Line.

Click on the Series X values field and then indicate the cell E2 (or whichever it’s in your case) on the active worksheet.

Do the same for the Series Y values field. But this time choose the average of the Y-axis values, which is in F2.

Click OK twice to plot this new series in the existing scatter plot.

Newly added data series
Newly added data series

The newly added data point will show, like the one shown in the above screenshot.

Error Bars
Error Bars

Now, you need to format the visibility of the Error Bar of this data point to show the actual vertical line, which is currently invisible due to inaccurate configurations.

Select the average data point in the scatter chart and click on the Chart Elements button in the top right corner of the graph.

Select Error Bars Percentage
Select Error Bars Percentage

Hover the mouse over the Error Bars menu in the Chart Elements context menu and click on the arrow that appears.

Choose Percentage from the overflow menu that shows up.

Now, select the Error Bars of the average data point in the scatter plot, right-click, and click on the Format Error Bars option.

Format Error Bars
Format Error Bars

The Format Error Bars navigation panel will show up on the right side.

Series Vertical Line Y Error Bars
Series Vertical Line Y Error Bars

Click on the Error Bar Options drop-down menu on the top and select Series “Vertical Line” Y Error Bars. The term Vertical Line might not be in your worksheet if you’ve entered a different Series name.

Vertical Error Bar config
Vertical Error Bar config

Here’s how to configure the Vertical Error Bar section:

  • Direction should be set to Both
  • End Style should be set to No Cap
  • Error Amount must be Percentage and set to 100
Fill and line configuration
Fill and line configuration

Now, click on the Fill & Line button situated on the top menu of the same navigation panel.

Configure the newly added vertical line in the following ways:

  • Color: Click on the Outline color box and choose a different shade for the vertical line.
  • Width: Set it to 1.5 pt.
  • Dash type: If you wish, you can click on this option in the navigation panel and choose a dashed line instead of a solid line.
How to add a vertical line in an Excel graph
How to add a vertical line in an Excel graph

Congratulations! You’ve successfully added a vertical line in an Excel scatter plot.

Add a Vertical Line to a Column Chart

Sample dataset 2

Let’s say you’ve got a column chart with multiple data points. You’d like to dynamically highlight each column one after the other using a vertical line.

Your data and the column chart might be similar to the one shown above.

X and Y axis reference values
X and Y axis reference values

Create another dataset in the same worksheet that will work as the reference points for the vertical one you’ll be making on the column chart.

There must be two data points, Value 1 and Value 2, for both the X and Y axes.

The X-axis will always have the same numerical value twice in Value 1 and Value 2. For example, if you want to put the vertical line over the 9th column in the chart, put 9 in both the cells of the X-axis.

For the Y axis, Value 1 should be 0, and Value 2 should be the original column’s Y-axis value, which is $899.00 for iPhone 13 (2021) in the current dataset.

You’re done setting up the additional cell reference requirements for this method.

Select Data column chart
Select Data column chart

Now, click anywhere on the chart area of the column chart, right-click, and click on the Select Data option in the context menu.

Select Data Source column chart
Select Data Source column chart

The Select Data Source dialog box will show up. Click on the Add button below the Legend Entries section.

Edit Series column chart
Edit Series column chart

The Edit Series dialog box will show up. Enter a Series name, like Vertical Line, and click OK twice to add this new data series.

Select the chart area again, right-click, and choose the Change Chart Type option from the context menu.

vertical line combo
vertical line combo

The Change Chart Type dialog box will show up. Select the Combo category on the All Charts tab.

You should now see the newly added series name, Vertical Line, below the Series Line column.

Scatter with Straight Lines and Markers
Scatter with Straight Lines and Markers

Click on the Line drop-down menu and select the Scatter with Straight Lines and Markers option. Click OK to update the Vertical Line data series.

Edit Vertical Line
Edit Vertical Line

Now, again bring up the Select Data Source dialog box, select the Vertical Line series, and click on the Edit button.

Edit Series column data
Edit Series column data

You should now see the Edit Series dialog box. Here’s how you need to configure the empty fields:

  • Series X values: Enter the two cell range references from E2 and F2. The actual cells might be different in your worksheet.
  • Series Y values: For this field, it should be E3 and F3. Again, check your own dataset for the actual cell address.

Click OK twice to apply the changes.

Add vertical line using Select Data
Add vertical line using Select Data

If you’ve entered the exact same values throughout this exercise, you’ll see the vertical line showing up on the 9th column of the chart.

Dynamically changing position of vertical line
Dynamically changing position of vertical line

Simply change the values of X and Y in the cell range reference table and the location of the vertical line will change dynamically.

Conclusions

So, these are some of the ways to add a vertical line to an Excel graph.

Use the manual method if you’re going to use this Excel skill occasionally.

On the contrary, if you need to use this skill frequently and expect that the dataset of the chart will change dynamically, use the second method.

I’ve also explained the second method for two different types of Excel charts, for example, Scatter Plot and Column Chart.

If you’ve found this Excel tutorial helpful or want to share any feedback, use the comment box.

About the Author

Bipasha Nath

Bipasha Nath

Bipasha is a technical content writer with 10+ years of experience in the technology industry. She previously worked in a SaaS software development company focused on SharePoint, OneDrive, Word, Excel, Word solutions.

Related Posts

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃