Chart & Visualization Issues

Add a Dynamic Horizontal Line to an Excel Scatter Plot

Tauseeq MagsiTauseeq Magsi Nov 25, 2026 870 views

Question details

Add a horizontal reference line to an Excel scatter plot that updates when the source data changes.

Add a Dynamic Horizontal Line to an Excel Scatter Plot
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants to show a formula-driven reference value across a scatter chart.
Observed behavior
The desired line should remain horizontal and move automatically as its calculated value changes.
Before you start

Identify the cells containing the scatter plot's X-values and the cells used to calculate the reference value. Make sure the source ranges include the rows you want the formulas to monitor.

Solution 1Recommended

Add a Formula-Driven Two-Point Series to the Scatter Plot

Use a separate series with matching Y-values to create a horizontal line that updates without macros.

The following example assumes X-values are in A2:A100 and the reference line should show the average of B2:B100. Adjust the ranges and reference formula for your data.

1
Create the line endpoints

In empty worksheet cells, enter =MIN(A2:A100) in D2 and =MAX(A2:A100) in D3. These formulas set the line's endpoints to the minimum and maximum source X-values.

2
Set the reference value

Enter =AVERAGE(B2:B100) in E2, then enter =E2 in E3. Both points now share the same Y-value; replace the average formula with your preferred calculation if needed.

3
Add the series

Click the scatter chart, then choose Chart Design > Select Data > Add. Enter a series name, set Series X values to D2:D3 and Series Y values to E2:E3, and click OK.

4
Connect the points

Select the chart and choose Chart Design > Change Chart Type. Set the new series to Scatter with Straight Lines if its points are not already connected.

5
Remove the markers

Right-click the new series and choose Format Data Series. Under Marker, set Marker Options to None, then adjust the line color and width under Line.

Add a Formula-Driven Two-Point Series to the Scatter Plot
Line width and chart axes: MIN and MAX span the source X-values, which may not reach the edges of the plotted area. To span fixed axis limits, use those limits as the two X-values instead.
Create a Dynamic Reference Line

Add a Dynamic Scatter Plot Reference Line in WPS Spreadsheet

Use WPS Spreadsheet to create two formula-driven endpoints, add them as a scatter chart series, and format the series as a horizontal reference line.

  1. 1. Open the workbook: Open WPS Spreadsheet and select Open to load the workbook containing your scatter chart.
  2. 2. Enter endpoint formulas: In empty cells, enter formulas for the minimum and maximum X-values, such as =MIN(A2:A100) and =MAX(A2:A100). In the adjacent cells, enter your reference formula and a reference to that result so both Y-values match.
  3. 3. Add the reference series: Select the chart, open Select Data from the chart tools or chart context menu, and add a series using the two X-value cells and two Y-value cells.
  4. 4. Format the line: Set the new series to a scatter type with straight lines if needed. Open Format Data Series, remove its markers, and choose a line color and width.
Create a reference line that updates with your worksheet formulas.Open and save Microsoft Excel XLSX files.Edit chart data and formatting in a familiar spreadsheet interface.Use WPS Office for free.
microsoft office alternative - wps office

Frequently Asked Questions

Can the reference line show a target instead of an average?

Yes. Enter the target value or a formula for it in the first Y-value cell, then reference that cell from the second Y-value cell. Both endpoints must have the same Y-value.

Why does the line stop before the edges of my chart?

MIN and MAX use the source data's X-values, while the chart axis may extend beyond them. Use the fixed horizontal axis minimum and maximum as the line's X-values if you want it to span those limits.

Why are there two points but no connecting line?

Select the chart and choose Chart Design > Change Chart Type. Set the reference series to Scatter with Straight Lines, then remove its markers in Format Data Series if desired.

Will the line update when I add new rows?

It updates for changes within the cells covered by its formulas. If new rows fall outside those ranges, expand the formula ranges or use an Excel table with structured references.