Add an Equation to an Excel Scatter Plot: Steps & Tips

How-to basics · Updated November 18, 2026

To add an equation to an Excel scatter plot in Microsoft 365 for Windows, select the chart, then choose Chart Design > Add Chart Element > Trendline > More Trendline Options. In the Format Trendline pane, select a model such as Linear and check Display Equation on chart; Excel places the fitted equation on the plot.

What the displayed equation means

A scatter plot places paired values on two numeric axes: one value is the x-coordinate and the other is the y-coordinate. A trendline summarizes a pattern in those points. When you display its equation, Excel shows the mathematical form of that fitted line or curve, rather than a formula that has been inserted into a worksheet cell.

For a linear trendline, the equation is usually written as y = mx + b. Here, x is the horizontal-axis value, y is the predicted vertical-axis value, m is the slope, and b is the y-intercept. For example, if a chart displays y = 2x + 1, a point with x equal to 4 has a predicted y value of 9. The trendline does not say that every observed point follows the equation exactly; it describes the fitted relationship.

Excel may also show an R-squared value if you select Display R-squared value on chart. R-squared indicates how closely the fitted model accounts for variation in the plotted y-values, on a scale that commonly runs from 0 to 1. A high value does not prove that the model is appropriate, that the relationship is causal, or that predictions beyond the data range will be reliable.

Add the equation step by step

  1. Arrange the observations in two columns, with the x-values in one column and the corresponding y-values beside them. Keep each pair on the same row.
  2. Select the data and insert an XY scatter chart using Insert > Insert Scatter (X, Y) or Bubble Chart. Choose a marker-only scatter style if you want to show the observations without connecting them in row order.
  3. Click the chart, then open Chart Design > Add Chart Element > Trendline > More Trendline Options. If the chart contains multiple data series, select the series whose trendline you want before adding it.
  4. In the Format Trendline pane, choose the trendline type that matches the relationship you want to describe. For a straight-line fit, choose Linear.
  5. Scroll within the pane and select Display Equation on chart. Select Display R-squared value on chart too if you want that statistic shown.
  6. Move or resize the equation label if it covers data. Click the label and drag it to an open area of the plot.

In some Excel layouts, clicking the chart displays a plus-sign Chart Elements button beside it. You can use that button to add a Trendline, then open its additional options to choose a model and display the equation. The ribbon route above gives direct access to the full trendline settings. Excel for Mac has comparable chart design and trendline controls, though their placement can vary slightly by release. Excel for the web may arrange chart controls differently from the Windows desktop version.

Choose a suitable trendline type

The equation is only useful when the chosen trendline is a reasonable description of the data. Excel offers several models; their availability and equation form depend on the selected trendline.

  • Linear: Use for an approximately straight relationship. The slope represents the estimated change in y for a one-unit increase in x.
  • Exponential: Use for a pattern that changes by a roughly consistent percentage or rate, rather than a consistent amount. Exponential trendlines cannot be calculated when the data contains zero or negative values.
  • Logarithmic: Use for a pattern that changes quickly and then levels off, when x-values are positive. It is not suitable if the x-values include zero or negative numbers.
  • Power: Use for a curved relationship that may be described by a power rule. Power trendlines require positive x- and y-values.
  • Polynomial: Use when the data bends or changes direction and a curved fit is justified. You can set the order in the pane; a higher order can follow more bends but may fit the observed points without capturing a dependable underlying pattern.
  • Moving average: Use to smooth fluctuations in a sequence of points. It is a smoothing line, not a single algebraic equation in the same sense as the other fitted models.

For a small data set that appears roughly straight, start with a linear model. Do not choose a more complicated curve simply because it produces a higher R-squared value. A model with more flexibility can match the points more closely while behaving poorly for new observations.

Make the equation easier to read

Excel places the equation as a chart label, so it can be moved and formatted separately from the trendline. Select the equation label to change its font, size, or position. To show more decimal places, right-click the label and choose Format Trendline Label, then adjust the Number settings. The precise pane options can vary by Excel release.

By default, displayed coefficients may be rounded. That matters when you use the printed equation for a calculation: a label that shows only a few decimal places may produce a slightly different answer from the fitted values stored internally by Excel. Increase the displayed precision for a clearer transcription, but do not assume the chart label is a high-precision calculation tool. If you need repeatable results, calculate the coefficients in worksheet cells or use the chart equation only as a visual summary.

Also check the axis scales and units. If x is measured in months and y in dollars, the slope is dollars per month, not a unit-free number. A chart with a truncated vertical axis can make a small difference look dramatic, while the equation itself remains tied to the original data values.

Calculate a linear equation in worksheet cells

For a straight-line relationship, worksheet functions can return the slope and intercept without reading rounded values from the chart label. For example, suppose x-values are in A2:A6 and corresponding y-values are in B2:B6. If the rows contain (1, 3), (2, 5), (3, 7), (4, 9), and (5, 11), the fitted line is y = 2x + 1.

With x-values in A2:A6 and y-values in B2:B6, enter this in a worksheet cell to calculate the slope; the result for the example is 2.

=SLOPE(B2:B6,A2:A6)

With the same values in A2:A6 and B2:B6, use this to calculate the y-intercept; the result for the example is 1.

=INTERCEPT(B2:B6,A2:A6)

With x-values in A2:A6 and y-values in B2:B6, this calculates the coefficient of determination for a linear fit; the example returns 1 because all five points lie exactly on the line.

=RSQ(B2:B6,A2:A6)

The chart’s displayed model and these functions should agree when they use the same observations and a linear trendline, apart from the chart label’s rounding. If you filter or change the data, check that the chart series and worksheet ranges still refer to the same points.

Use the equation for estimates with care

Once you have a linear equation, substitute an x-value to estimate the corresponding y-value. With the example equation y = 2x + 1, x equal to 6 gives a predicted y of 13. This is an extrapolation because 6 is outside the observed x range of 1 through 5. The arithmetic is straightforward, but the prediction is only credible if the relationship is expected to continue beyond the measured data.

Interpolation means estimating between observed x-values, which is generally less demanding than extrapolating far outside them, but it still relies on the model being appropriate. Neither a trendline nor a high R-squared value accounts automatically for changing conditions, unusual points, measurement error, or a relationship that bends outside the plotted range. Label estimates as predictions and state the range of data used to create the model when the result will inform a decision.

Common problems and fixes

  • No equation option appears: Confirm that you added a trendline to a data series and opened its formatting options. Selecting the chart area alone is not the same as selecting a series or its trendline.
  • The line seems to connect points in an odd order: A scatter chart uses numeric x-values, but a line chart can treat horizontal positions as categories. Use an XY scatter chart when the x-values are actual numbers or dates whose spacing matters.
  • The equation looks unrelated to the points: Check which series the trendline belongs to, verify that the correct columns supply x and y, and review the trendline type. A polynomial or logarithmic model can behave very differently from a linear fit.
  • The equation label covers the data: Select and drag it, or enlarge the chart area. You can also format the label for readability without changing the fitted model.
  • The equation copied into a calculation gives a slightly different answer: Increase the label’s displayed decimal places or calculate coefficients with SLOPE and INTERCEPT. Rounded display text can lose precision.
  • A curved trendline cannot be added: Check the data restrictions for the selected model. Exponential, logarithmic, and power fits have restrictions involving zero or negative values.

Frequently Asked Questions

Can I add an equation without adding a trendline?

Excel’s chart equation label belongs to a trendline, so the built-in option requires a trendline. If you only want text on the chart, you can add a text box, but you must enter and maintain that text yourself; it will not automatically update as a fitted equation when the data changes.

How do I show the equation and R-squared on an Excel chart?

Select the chart and add a trendline through Chart Design > Add Chart Element > Trendline > More Trendline Options. In the Format Trendline pane, check both Display Equation on chart and Display R-squared value on chart.

Why does my scatter plot equation use the wrong x-values?

Check the series data ranges. Right-click the chart and choose Select Data, select the series, and confirm that the Series X values and Series Y values ranges point to the intended cells. A scatter chart’s horizontal values should be set explicitly as X values, not treated as category labels.

Can the equation update when I change the data?

Yes, when the chart series refers to cells that are updated, Excel recalculates its trendline and equation label. If you manually typed an equation into a text box or copied rounded coefficients into cells, that separate text or calculation will not necessarily update with the chart.

Why is the displayed equation rounded?

The equation label uses a number format that controls how many decimal places are shown. Format the trendline label and increase its displayed precision. For calculations that need reliable coefficient values, use worksheet functions rather than copying a rounded chart label.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.