You cannot directly link an Excel chart’s displayed trendline equation to a worksheet cell with a built-in formula. To put the equation in cells, calculate the same regression from the chart’s X and Y data with worksheet functions, then optionally combine the results into a readable text label.
Why the chart equation is not a cell value
When you add a trendline to a chart, Excel draws a fitted line or curve and can display its equation as a chart label. That label belongs to the chart, not to a worksheet cell. Excel does not provide a standard cell reference such as a link to “the equation shown on this chart.” Copying the chart label is therefore not a dependable way to create a live cell value: it may copy or move a chart object rather than give you a formula that updates with the data.
The reliable approach is to calculate the regression in the worksheet using the same observations and trendline type as the chart. The resulting slope, intercept, or other coefficients can be used in calculations, formatted for display, or referenced by other formulas. This distinction matters: a chart label is presentation, while regression coefficients in cells are usable data.
If you only need a one-time note, you can read the equation from the chart and type it into a cell. That entry will not update when the source values change, and its rounded coefficients may not reproduce the chart’s fitted values precisely.
Calculate a linear trendline in cells
For a linear trendline, Excel’s SLOPE and INTERCEPT functions return the two coefficients in the familiar equation y = mx + b. SLOPE returns m, the change in Y for a one-unit increase in X; INTERCEPT returns b, the estimated Y value when X is zero.
For example, put X values 1, 2, 3, 4, and 5 in A2:A6, and the corresponding Y values 3, 5, 7, 9, and 11 in B2:B6. With Y values in B2:B6 and X values in A2:A6, enter =SLOPE(B2:B6,A2:A6) in D2. It returns 2. With the same layout, enter =INTERCEPT(B2:B6,A2:A6) in D3. It returns 1. The fitted equation is therefore y = 2x + 1; for x = 5, it predicts 11.
The argument order is important: both functions take the known Y values first and the known X values second. The X and Y ranges must contain corresponding observations, so the first value in one range must pair with the first value in the other. Do not reverse the ranges simply because the chart has X on the horizontal axis.
To have a cell display a neatly rounded equation, put the slope in D2 and intercept in D3 as above. With those values in D2 and D3, enter ="y = "&TEXT(D2,"0.000")&"x "&IF(D3<0,"- ","+ ")&TEXT(ABS(D3),"0.000") in D4. The example returns “y = 2.000x + 1.000.” TEXT controls the displayed precision, while the underlying coefficients remain numeric in D2 and D3.
Match the worksheet calculation to the chart
A calculation will match the chart only if both use the same data and model. Check the chart’s selected series, its X and Y ranges, and its trendline type before comparing equations. An XY (Scatter) chart is usually the appropriate chart for numeric X values because it positions points according to their numeric values. In a category chart, the horizontal positions may instead represent categories, so treating category labels as numeric X values can produce a different regression.
Also check whether the chart or source data omit observations, whether the series uses a filtered-data setting, and whether blanks or nonnumeric entries are present. A worksheet calculation over A2:A100 will not match a chart fitted to only a subset of those rows. Use the same paired observations in both places, and confirm the data has not been sorted in a way that separates X values from their matching Y values.
In Excel for Microsoft 365 on Windows, select the chart, click the data series, and use Chart Design > Add Chart Element > Trendline to add or change a trendline. To show its equation, use Chart Design > Add Chart Element > Trendline > More Trendline Options, then select Display Equation on chart. The pane also contains the option to display the R-squared value. On Mac, the chart tools and pane names can vary slightly by Excel release; select the series and open its Format Trendline options to find the equation setting. Excel for the web has fewer chart-formatting controls than the desktop app, so use desktop Excel if a needed trendline option is unavailable.
Precision, rounding, and R-squared
The equation printed on a chart is commonly rounded for readability. A label such as y = 2x + 1 may hide additional decimal places in the fitted coefficients. That is why calculations based on the displayed text can differ slightly from chart predictions even when the data and trendline are the same. To show more digits, format the equation label: select the equation on the chart, open the Format Trendline Label pane, and adjust its number format or decimal places where available. You can also choose an appropriate number format for the worksheet coefficients.
More displayed digits do not improve the fit; they only reveal more of the calculated coefficient values. Keep the full numeric results in cells for further calculations and use TEXT only to control how a separate display cell looks. A number converted into an equation string is text, so it cannot be used as a numeric slope without extracting or separately referencing the coefficient.
R-squared is another chart value readers often want in a cell. For a simple linear regression with an intercept and paired data in B2:B6 and A2:A6, enter =RSQ(B2:B6,A2:A6) in a worksheet cell. In the example, it returns 1 because every point lies exactly on the line. R-squared describes how closely the fitted values correspond to the observed values under the model; it is not the slope, and a high value alone does not establish that a model is appropriate.
Other trendline types need different calculations
SLOPE and INTERCEPT reproduce a linear trendline, not every model available in Excel’s chart options. Excel can also fit logarithmic, polynomial, power, and exponential trendlines. The corresponding equation may have different coefficients and transformations, so copying the linear formulas into cells will not reproduce those chart equations.
- Polynomial: The model includes powers of X, such as x squared. The degree selected in the chart matters. Reproduce it with a multiple-regression calculation using the matching powers of X; the coefficient order and chart equation formatting must be checked carefully.
- Exponential: The model is commonly expressed in a form such as y = a e^(bx). A log transformation can be used to fit a straight line to the logarithm of positive Y values, but the transformed regression and conversion back to a and b must match Excel’s model conventions.
- Power: The model uses powers of X and generally requires positive X and Y values for a log-based fit. It is not the same as a polynomial trendline.
- Logarithmic: The model uses the logarithm of X and requires suitable positive X values. A linear fit against transformed X values is needed rather than a standard SLOPE call on the original X values.
These transformed approaches can be useful, but exact matching requires care about included points, logarithm conventions, restrictions on input values, and coefficient rounding. If the chart uses a non-linear trendline and exact agreement is important, verify the worksheet method against several chart predictions rather than relying on a copied, rounded label. A displayed equation is a compact summary, not a complete record of every chart setting.
Use the coefficients for predictions, not just display
Keeping coefficients in separate numeric cells makes the trendline useful beyond a label. With slope in D2, intercept in D3, and a new X value in A7, enter =$D$2*A7+$D$3 in B7 to calculate the linear prediction. For the example coefficients, if A7 contains 6, the result is 13. The dollar signs keep the coefficient references fixed if you fill the formula down a column.
This formula evaluates the fitted line; it does not calculate a confidence interval or explain whether extrapolating beyond the observed X range is sensible. A line that fits the existing points well may not describe behavior outside that range. In reports, identify predicted values as estimates and make clear which observations and model produced them.
Keeping the equation text in a separate cell is also helpful for titles, notes, and reports. You can reference the text cell from a worksheet label, but remember it is a formatted description. For further calculations, reference the underlying numeric coefficient cells instead.
Common reasons the numbers do not match
- Reversed arguments: SLOPE and INTERCEPT expect Y first and X second. Reversing them fits a different relationship.
- Different points: The chart and worksheet ranges may include different rows, filtered records, or missing values.
- Wrong model: A polynomial, exponential, logarithmic, or power trendline cannot be recreated with only a linear slope and intercept.
- Rounded label: The chart displays fewer digits than the coefficients used internally.
- Different X interpretation: A category axis may not represent numeric X spacing the way an XY scatter chart does.
- Unpaired data: Sorting one column without sorting the other changes which X and Y values are treated as pairs.
When troubleshooting, first verify the chart series data, then check the selected trendline type, then compare the full-precision worksheet coefficients. Comparing only the visible equation is a weaker check because its formatting may conceal meaningful decimal places.
When manual copying is enough
If the equation is needed once for a document and will not change, typing the displayed equation into a cell may be the quickest option. Include enough decimal places for the intended use and label it as a manually recorded equation. Do not treat it as a live link or use its rounded text as the basis for precise forecasts.
If the data changes regularly, use coefficient formulas and a separate equation-display cell. This is more transparent and updateable than manually revising the label. For a non-linear model, document the transformation or regression method too, so another reader can tell how the coefficients were obtained.
Frequently Asked Questions
Can I link a chart trendline equation directly to a cell?
No standard worksheet formula links directly to the chart’s equation label. Calculate the coefficients from the source data in cells, or manually type a one-time copy that will not update.
How do I get the slope and intercept into Excel cells?
With Y values in B2:B6 and matching X values in A2:A6, use =SLOPE(B2:B6,A2:A6) for the slope and =INTERCEPT(B2:B6,A2:A6) for the intercept. The functions return numeric values that you can reference in later calculations.
Why does my worksheet equation differ from the chart label?
Check that the chart and formulas use the same X and Y observations and the same model. The chart label may also round coefficients, or the chart may use a category axis or a trendline type other than linear.
Can I copy the equation text from the chart and paste it into a cell?
Copying a chart element is not a reliable way to create a live worksheet value. If you need a static note, type the equation into a cell. If you need it to update, calculate and format the coefficients in cells.
Can I calculate a polynomial trendline equation the same way?
Not with just SLOPE and INTERCEPT. A polynomial uses multiple powers of X, and the calculation must use the degree selected for the chart. Use a matching multiple-regression method and verify its coefficients against the chart.
Related
- Change Date Format in Excel: General Format Explained
- Excel Date Format: Change Defaults and Cell Settings
- How to Change Date Format in an Excel Column Easily
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Power Pivot Calculated Field: Measures vs ColumnsIn Power Pivot, an aggregated calculation for a PivotTable is usually a DAX measure, often informally called a…
- Excel Chart Not Plotting Zero Values? How to Fix ItExcel normally plots numeric zero values, but a zero can be hard to see: a zero-height column has…
- Excel Chart With Drop-Down List: How to Create OneYes. In Excel for Microsoft 365 on Windows, create a drop-down with Data Validation, use a helper column…
- Google Sheets Pivot Table Formatting: A Practical GuideTo format a pivot table in Google Sheets, click a cell in the table and use the toolbar…
- Excel Chart Error Bars: How to Add and Customize ThemExcel chart error bars show the amount of uncertainty, variation, or measurement range associated with plotted values. In…
- How to Find the Gradient of a Trendline in Excel EasilyTo find a trendline’s gradient in Excel, calculate its slope with SLOPE or display the equation on a…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.