How to Insert a Horizontal Line in an Excel Graph
In this article
You cannot add a horizontal line directly to an Excel chart with a single button. Instead, you add a second data series that contains the same value for every category, then change that series to a line chart type. This creates a horizontal reference line at the exact value you choose, such as a target, average, or threshold. The steps below work in Excel for Microsoft 365, Excel 2021, and Excel 2019 on Windows and Mac; labels and ribbon positions can differ slightly by version and region.
What You'll Need
- Your existing chart in Excel (column, bar, or line chart).
- A small helper table with the same categories as your chart and a column of identical values for the line.
- Excel for Microsoft 365, Excel 2021, or Excel 2019. Older versions may have slightly different ribbon labels.
Step-by-Step
- Decide the value for the line. For a target line, use the target number. For an average line, calculate the average of your data with a formula such as
=AVERAGE(B2:B10)in an empty cell. Note the result because you will type it into the helper table. - Build the helper table. Next to your source data, create a column with the same category labels as your chart. In the next column, enter the same value in every row. For example, if your chart categories are in A2:A10 and you want a line at 75, put 75 in B2:B10. The helper table must have the same number of rows as the chart categories.
- Add the helper series to the chart. Right-click the chart and choose Select Data. In the Select Data Source dialog, click Add under Legend Entries (Series). For Series name, select the header of your helper value column. For Series values, select the range of identical values (for example B2:B10). Click OK twice to close the dialogs.
- Change the new series to a line. The new series probably appears as columns or bars. Right-click that series in the chart and choose Change Series Chart Type. In the dialog, set the helper series to Line. If Excel opens the full Change Chart Type dialog, use the Combo tab and set the helper series to Line while leaving the original series as Column or Bar. Click OK.
- Format the line. Right-click the line and choose Format Data Series. In the Format pane, set the line color, width, and dash type. A dashed line in a contrasting color is a common choice for a target or average line. You can also add a label by right-clicking the line and choosing Add Data Labels, then positioning the labels above the line.
- Clean up the legend. The helper series appears in the legend. If you do not want it there, click the legend once to select it, then click the helper series entry and press Delete. Alternatively, rename the series to something meaningful such as "Target" in the Select Data Source dialog.
- Check the axis scale. If the line sits at the very top or bottom of the plot area, right-click the value axis and choose Format Axis. Adjust the minimum and maximum bounds so the line is visible within the chart area. This is especially important when the target value is far from your data range.
Common Mistakes
- Using a different number of rows. If the helper column has fewer or more rows than the chart categories, Excel may misalign the line or refuse to plot it correctly. Match the row count exactly.
- Forgetting to change the series type. Adding the series is not enough; it will appear as another column or bar until you change it to a line chart type.
- Typing the value once and dragging incorrectly. If you drag the fill handle, make sure every cell contains the same number. A single different value creates a sloped line instead of a horizontal one.
- Leaving the helper series in the legend. This is cosmetic but can confuse readers who see an unexplained extra entry.
- Not updating the line when data changes. If you type a fixed value, the line stays fixed. Use a formula reference to an average cell if you want the line to update automatically.
Tips
- For an average line that updates automatically, put
=AVERAGE(B2:B10)in a cell, then make every helper cell reference that cell (for example=$D$2). The line will move when the data changes. - Use a dashed line style for targets and a solid line for averages so readers can tell them apart at a glance.
- If you need multiple horizontal lines (for example an upper and lower threshold), add two helper columns and repeat the process for each series.
- On a line chart, the helper series appears as a flat line automatically; you may only need to format it rather than change its chart type.
- Keep the helper table on the same sheet as the chart data or on a separate sheet; either works, but a separate sheet keeps your main data clean.
Troubleshooting
The line does not appear at all. Check that the helper series was actually added in Select Data and that its values are numbers, not text. Text values plot as zero or are ignored.
The line is sloped instead of horizontal. One or more helper cells contain a different value. Select the helper range and confirm every cell is identical.
The line is hidden behind bars. Right-click the line and choose Format Data Series, then look for a Series Overlap or Gap Width setting in the chart type options, or simply change the line color to something bright. On combo charts, the line is usually drawn on top, but formatting can vary.
The line sits outside the visible chart area. Adjust the value axis bounds in Format Axis so the line falls within the minimum and maximum.
The legend shows an unwanted entry. Delete the legend entry as described in step 6, or rename the series to a meaningful label.
Change Series Chart Type is greyed out. Make sure you right-clicked the data series itself, not the chart area or a gridline. If the chart is a specific type that does not support combo charts, such as a pie chart, you cannot add a line series; convert the chart to a column or bar chart first.
Frequently Asked Questions
Can I add a horizontal line without a helper column?
No. Excel charts plot data series, so you need a series of identical values. There is no built-in "add reference line" button in Excel chart tools.
Will the line update when my data changes?
Only if the helper cells contain formulas that reference a cell, such as an average. If you type a fixed number, the line stays fixed.
Does this work on Excel for Mac?
Yes. The menu names are similar, though right-click menus and dialog layouts can differ slightly. The Select Data and Change Series Chart Type commands are available on Mac.
Can I add a horizontal line to a pie chart?
No. Pie charts do not support combo series. Use a column or bar chart if you need a reference line.
How do I remove the line later?
Right-click the line and choose Delete, or open Select Data and remove the helper series from the list. Deleting the helper table alone will leave an empty series in the chart.
Can I label the line with text such as "Target"?
Yes. Right-click the line and choose Add Data Labels, then edit the label text, or rename the series in Select Data so the legend shows the label.