To show an equation on an Excel scatter plot, select the chart and choose Chart Design > Add Chart Element > Trendline > More Trendline Options. In the Format Trendline pane, choose a trendline type and check Display Equation on chart; Excel adds the fitted equation as a label you can move on the chart.
What the trendline equation tells you
A scatter plot places each observation at an x-value and a y-value. A trendline summarizes the relationship between those variables with a mathematical model. Its displayed equation tells you how Excel estimates y from x for the selected trendline type. It is a description of the fitted pattern, not a guarantee that every point follows the pattern or that one variable causes the other.
For a linear trendline, Excel displays an equation in the form y = mx + b. The coefficient m is the slope: the estimated change in y for a one-unit increase in x. The intercept b is the model’s estimated y-value when x is zero. For example, in y = 0.8x + 1.5, the line rises by 0.8 y-units for each additional x-unit, and its fitted value at x = 0 is 1.5.
The equation uses the chart’s numeric x- and y-values, including their units and scale. If x represents hours and y represents distance in kilometres, the slope is kilometres per hour. Changing units—for example, converting hours to minutes—changes the coefficient even if the underlying observations are identical.
How to add the equation in Excel for Microsoft 365
For a standard scatter chart in Excel for Microsoft 365 on Windows, use these steps:
- Select the x- and y-value columns, including headers if you have them. Keep each x-value paired with its corresponding y-value.
- Choose Insert > Insert Scatter (X, Y) or Bubble Chart, then select a scatter-chart style. A chart with markers is a useful starting point.
- Select the chart, then choose Chart Design > Add Chart Element > Trendline > More Trendline Options.
- In the Format Trendline pane, select the appropriate model, such as Linear. Under Trendline Options, check Display Equation on chart. Check Display R-squared value on chart too if you want that statistic.
- Select the equation label and drag it to a clear place on the chart. Add axis titles and units so readers can interpret the coefficients.
You can also select the chart, use the Chart Elements (+) button beside it, and choose Trendline > More Options. The exact pane layout can vary slightly with window size and Excel updates. In Excel for Mac, the Chart Design tab and trendline controls are also available, though the pane layout may differ. Excel for the web has fewer chart-formatting controls; if the equation option is not available in your workbook, open it in the desktop app.
Choosing the right trendline type
Excel offers several models. A more complex curve can follow a curved pattern, but choosing one simply because it looks closer to the points can overfit noise. Consider the data’s shape and what the model means in context:
- Linear: A straight-line relationship, written y = mx + b. Use it when the rate of change is reasonably constant across the range.
- Exponential: A curved model often used for growth or decay at a rate proportional to the current value. It requires positive y-values.
- Logarithmic: A curve that can rise or fall quickly and then flatten. It requires positive x-values.
- Polynomial: A curve that can bend or turn. Excel lets you select an order from 2 through 6; higher orders can produce unstable curves, especially outside the observed data.
- Power: A model of the form y = ax^b, useful for some proportional or scaling relationships. It requires positive x- and y-values.
- Moving average: A smoothing line based on successive groups of points, with a period you choose. It helps reveal short-term variation in an ordered series, but it is not a single fitted equation like the other models.
For many ordinary x-y comparisons, start with a linear fit and inspect the scatter itself. A systematic curve in the residual pattern or a clear scientific reason may justify another model. Do not choose a polynomial just because its R-squared value is higher; adding flexibility usually makes it easier to fit the existing points.
Worked example: interpreting a linear equation
Suppose x-values in A2:A5 are 1, 2, 3, and 4, while the paired y-values in B2:B5 are 2, 3, 5, and 4. A linear trendline for those points is y = 0.8x + 1.5. The slope is 0.8, and the intercept is 1.5. At x = 5, substituting into the line gives an estimated y of 0.8 × 5 + 1.5 = 5.5. That is a model prediction, not an observed value.
You can check a linear chart’s coefficients with worksheet functions. With x-values in A2:A5 and y-values in B2:B5, the slope formula is =SLOPE(B2:B5,A2:A5); it returns 0.8. With the same layout, the intercept formula is =INTERCEPT(B2:B5,A2:A5); it returns 1.5. With the same layout, the coefficient of determination is =RSQ(B2:B5,A2:A5); it returns 0.64. These functions can help verify the chart’s fit, but use matching ranges and the same observations as the chart.
What R-squared means—and what it does not
When you display R-squared, Excel reports how closely the selected model accounts for variation in the y-values in the data used for the fit. In the four-point example, R-squared is 0.64 for the linear model. That indicates the fitted line accounts for 64% of the variation in those y-values under the usual regression interpretation.
R-squared is not the probability that the equation is correct, a measure of causation, or proof that the model will predict new observations accurately. A high value can result from a strong relationship, a narrow range of observations, or an overly flexible curve. A low value can still accompany a useful trend when real-world data are noisy. Inspect the points, consider the number of observations, and ask whether the model makes sense for the subject.
Equation precision and chart-label formatting
The equation printed on the chart is rounded for display. A label might show coefficients with only a few decimal places, so plugging those rounded numbers into a calculator can produce a slightly different result from Excel’s underlying fitted line. Do not assume the short label preserves full precision.
To make the label easier to read, select the equation label and open its formatting options—right-click it and choose Format Trendline Label, or use the formatting pane. Under Number, adjust the number format and decimal places if those controls are available for the label. More decimal places can help when coefficients are small, but excessive digits imply a level of certainty the data may not support. For calculations that need precision, use functions such as SLOPE and INTERCEPT on the source data rather than copying rounded coefficients from the chart.
Also check whether the displayed equation is readable against the chart background and does not cover important points. You can drag the label, resize the chart, or move the legend. If a coefficient appears as zero after rounding, increase the displayed decimal places before concluding that the fitted relationship has no slope.
Common problems and limitations
- The equation option is missing: Confirm that the selected object is a trendline, not the chart or a data series. Add a trendline first, then select it and open its formatting pane. Some trendline types, notably moving averages, do not provide a conventional equation label.
- The line does not match the data: Check that the chart is an XY scatter plot and that Excel assigned the intended x- and y-value ranges. A line chart treats its horizontal axis differently and may not represent numeric x-spacing as you expect.
- The equation looks wrong: Verify that the x-values are in the x range and y-values are in the y range. Check for text-formatted numbers, blanks, or an unintended data series. Axis display settings can also make a sound fit look visually steep or flat.
- The curve predicts implausible values: Trendlines are fitted to the selected observations. Extending them far beyond the observed x-range is extrapolation, and the relationship may not continue there. Exponential, logarithmic, and power models also have domain restrictions.
- The fit changes after editing the chart: Adding or removing points, changing a series range, or changing the trendline type changes the fitted coefficients. Make sure the chart includes the intended observations and that excluded points have a defensible reason for exclusion.
A trendline is a summary, not a substitute for checking unusual points or the data collection process. A single outlier can strongly affect a linear fit, and a cluster of points may reflect different groups or conditions. If predictions matter, evaluate the model with relevant subject knowledge and data beyond the points used to fit it.
When to use a different way to report the fit
A chart equation is convenient for presentation and quick interpretation. It is less suitable as the sole record of a precise analysis because the label is rounded, can be moved or removed, and may not explain the model’s assumptions. Keep the original observations and, where useful, report the equation, chosen trendline type, R-squared value, sample size, and units in nearby text or a table.
If you need predicted values across many x-values, put the model calculation in worksheet cells rather than reading values off the graphic. For a linear model, use the unrounded slope and intercept calculated from the same data, and label predictions as estimates. For a non-linear model, use the appropriate model form and check that inputs fall within its valid domain. Excel’s chart equation is most helpful as a compact visual explanation, not as a complete statistical report.
Frequently Asked Questions
How do I show a trendline equation in Excel?
Select the scatter chart, choose Chart Design > Add Chart Element > Trendline > More Trendline Options, select a trendline, and check Display Equation on chart.
Why is the equation not showing on my Excel scatter plot?
The trendline may not be selected or added yet. Open its Format Trendline pane and check the equation option. A moving average does not have the same single fitted equation as a linear or polynomial trendline.
How do I get more decimal places in an Excel trendline equation?
Select the equation label, open Format Trendline Label, and look under Number for decimal-place controls. The chart label is rounded; use SLOPE and INTERCEPT on the source ranges when you need the coefficients for calculations.
What does the x mean in a trendline equation?
The x represents an input value on the scatter plot’s horizontal axis, and y is the corresponding model estimate on the vertical axis. Interpret both using the chart’s units; the equation does not automatically identify what the variables mean.
Is a higher R-squared always a better trendline?
No. A higher value means the model fits the displayed observations more closely by that measure, but it does not prove the model is appropriate or predictive. Compare plausible models, inspect the data, and avoid adding complexity only to raise R-squared.
Related
- Excel Sheet Password Remover: Safe Ways to Unlock It
- Excel Protect Sheet: How to Select Unlocked Cells Only
- Excel Protect Sheet Greyed Out? Causes and Fixes
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Excel Stacked Line Chart ExplainedAn Excel stacked line chart plots each series as a running total of the series before it, rather…
- Excel: Hide Columns Without Affecting Your Chart ViewYes. In Excel for Microsoft 365 on Windows, select the chart, go to Chart Design > Select Data…
- Pie Chart Speedometer in Excel: Build a GaugeTo make a pie chart speedometer in Excel, build a doughnut chart from the measured value, the unused…
- Excel Box Plot: Add a Series and Expand the Chart DataTo add a series to an Excel box plot in Microsoft 365 for Windows, select the chart, choose…
- Excel Histogram Groups: Set and Change Bin SizesExcel histogram groups numerical values into bins—ranges such as 0–10, 10–20, and 20–30—and counts how many observations fall…
- Graph the Line y = x – 5: Slope, Intercepts, and StepsAssuming you mean y = x – 5, graph a straight line with slope 1 and y-intercept -5.…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.