To put a trendline in an Excel graph, select the chart, choose Chart Design > Add Chart Element > Trendline, then select a trendline type, such as Linear. Before you start, make sure your chart contains the data series you want to analyze. A trendline helps show the general direction or pattern in plotted data; it does not change the values in your worksheet.
What You’ll Need
- An Excel workbook with numeric data arranged in columns or rows. Include clear headings so you can identify the series.
- A chart that supports trendlines. For the widest range of trendline options, use a two-dimensional chart such as a scatter, line, column, or bar chart. A scatter chart is usually the best choice when both the horizontal and vertical values are numeric.
- Excel for Microsoft 365 on Windows for the steps below. The same chart features are available in many recent Excel for Mac versions, although ribbon placement and pane layout can vary slightly.
Step-by-Step
- Check that the chart is based on the right data. Each row or column should represent the series you want to analyze, and the chart should include the intended observations. If you have not made a chart yet, select the data, including its headings, then choose Insert and select an appropriate chart type. Choose a scatter chart if you have one numeric variable for the horizontal axis and another for the vertical axis. For example, to show how advertising spend relates to sales, plot spend on the horizontal axis and sales on the vertical axis.
- Select the chart. Click inside the chart so Excel displays the chart-specific tabs on the ribbon, including Chart Design and Format. Clicking the chart area selects the chart, but you will need to select a particular data series before adding its trendline. A series is the group of related points or bars represented by one legend entry.
- Select the series to analyze. Click one of the plotted points, bars, or line segments for the series you want to fit. The entire series should become selected, rather than only one data point. If several series overlap, click a point that is easy to distinguish or use the chart’s legend to identify the series. You can also click the chart, open Format, and use the Current Selection list to choose a series by name.
- Open the Trendline menu. On the ribbon, choose Chart Design > Add Chart Element > Trendline. Excel displays a list of available trendline types. If you do not see the chart tabs, click the chart again. If the Trendline option is unavailable, check the chart type and the selected object; a trendline applies to a data series, not to the chart title, plot area, or an individual point.
- Choose a trendline type. Select Linear for a roughly straight, steady increase or decrease. Choose Exponential for data that rises or falls at an increasing rate and stays on one side of zero. Logarithmic can suit data that changes quickly at first and then levels off. Polynomial can follow a curved pattern, while Moving Average smooths short-term variation. The line appears on the chart once you choose a type. Start with the simplest type that makes sense for the data rather than choosing a more complicated curve just because it follows every point.
- Open the detailed settings if needed. For more control, select Chart Design > Add Chart Element > Trendline > More Trendline Options. Excel opens the Format Trendline pane. Select the trendline type there, then adjust the options that appear for that type. For a polynomial trendline, set the order; a higher order can produce more bends and may overfit a small data set. For a moving average, set the period, which controls how many points are averaged for each smoothed value.
- Set an intercept or forecast only when it makes sense. In the Format Trendline pane, some trendline types let you set an intercept, and the pane includes forecast settings for projecting the line forward or backward. Forecast distances use units on the chart’s horizontal scale. An intercept constraint forces the fitted line through a value you specify, so do not set one merely to make the line touch the origin. Use it only when the data or the underlying relationship supports that constraint.
- Show the equation or R-squared value if useful. In the Format Trendline pane, select Display Equation on chart to show the fitted equation, or select Display R-squared value on chart to show a measure of how closely the trendline fits the plotted data. These checkboxes are usually near the bottom of the pane. Drag the displayed label to a clear place on the chart so it does not cover data. An R-squared value is not proof that the trendline is appropriate or that one variable causes another.
- Format and label the result. With the trendline selected, use the formatting controls in the Format Trendline pane to change its line color, width, or dash style. Give the chart a descriptive title and make sure axis titles explain what the values represent. If the chart has more than one series, confirm that the trendline is visually associated with the correct series. Save the workbook when the chart is ready.
To change the trendline later, select it and reopen Format Trendline, or use the Trendline menu to choose another type. To remove it, select the trendline and press Delete, or use Chart Design > Add Chart Element > Trendline > None. Removing the chart line does not remove or alter the source data.
Common Mistakes
- Adding the line to the wrong series: A chart can contain multiple series, and Excel fits a trendline to the currently selected one. Check the legend and selection before adding it. If necessary, delete the misplaced line, select the intended series, and add it again.
- Using a line chart for numeric X values: A standard line chart generally treats its horizontal axis as categories with even spacing. If dates or measurements are unevenly spaced, a line can imply equal gaps when the actual intervals differ. Use an XY scatter chart when the horizontal values are truly numeric and their spacing matters.
- Picking a complicated fit too quickly: A high-order polynomial may bend around individual points without representing a useful pattern. Compare it with a linear fit, check whether the curve makes sense for the subject, and avoid projecting far beyond the observed data without a good reason.
- Treating the equation as exact: The displayed equation is rounded for readability, so calculations based on its displayed coefficients may not reproduce the chart line exactly. R-squared describes fit for the included data; it does not establish causation or guarantee future accuracy.
- Including totals, blanks, or unintended values: A total row can pull the trendline away from the individual observations. Review the chart’s source range and confirm that it contains only the data points you mean to analyze.
Tips
- Use a descriptive series name. Clear column headings make the legend and the chart’s Current Selection list easier to understand, especially when a chart has several series.
- Keep the chart readable. A thin, contrasting line is often easier to interpret than a bright line that competes with the data. If you show an equation or R-squared, move the label away from points and axis labels.
- Compare plausible options. A linear fit is a useful baseline. Try another type only if the shape of the data and the context support it, then consider whether the fit is meaningfully better rather than relying on appearance alone.
- Make forecasts cautiously. Forecast settings extend the fitted line; they do not account automatically for changing conditions or uncertainty. A short extension may be easier to defend than a long projection beyond the range of observed values.
- Keep the chart connected to its source data. When you add or change values in the chart’s source range, Excel can update the plotted data and trendline. Check the range if new points do not appear.
Troubleshooting
The Trendline command is missing or disabled. First click the chart, then select an actual data series rather than the chart background, a label, or an individual point. If the command is still unavailable, the chart type may not support trendlines. Change to a supported two-dimensional chart, such as a scatter or line chart. Trendlines are not available for every chart design; for example, pie, doughnut, radar, and three-dimensional charts do not support them.
The line appears, but it follows the wrong data. Delete the trendline, select the correct series, and add the line again. If the chart’s series are difficult to select, open Format and use the Current Selection list to choose the series by its legend name. Confirm that the chart itself uses the intended worksheet cells.
The trendline is unexpectedly flat or sharply curved. Check whether the chart has the correct horizontal and vertical data, and whether the selected type matches the relationship you expect to examine. For a scatter chart, inspect the X and Y ranges assigned to the series. For a line chart, remember that category spacing may not reflect actual numeric intervals. Also check for an accidental total or outlier in the plotted range.
The forecast goes the wrong distance, or the displayed equation is hard to read. Reopen Format Trendline and check the forecast units against the horizontal axis scale. If the axis represents days, months, or another scale, make sure the entered distance is appropriate to those units. To improve equation readability, move its label, resize the chart, or format the text. The displayed equation may be rounded, so it is not a substitute for the chart’s full-precision calculation.
The steps look different on Mac or in Excel for the web. In Excel for Mac, select the chart and look for Chart Design and its Add Chart Element menu; some versions present the formatting pane differently. Excel for the web may have a more limited or changing set of chart controls. If you cannot find the trendline type or formatting option there, open the workbook in the desktop Excel app and follow the ribbon steps above.
Frequently Asked Questions
What is the easiest trendline to add in Excel?
For a simple first look, select the series and choose Chart Design > Add Chart Element > Trendline > Linear. It shows a straight-line direction through the data.
Can I add a trendline to every chart type?
No. Many two-dimensional charts support trendlines, but chart types such as pie, doughnut, radar, and 3-D charts do not. If the command is unavailable, try a two-dimensional scatter, line, column, or bar chart.
How do I add a trendline to just one data series?
Select a point or line in the series you want to analyze, then add the trendline. Excel applies it to that selected series. Repeat the process for another series if you need a separate trendline.
Which trendline should I use?
Use Linear when the pattern is approximately straight. Exponential, logarithmic, polynomial, power, and moving-average options suit different shapes or smoothing needs, but the data and subject matter should justify the choice. Do not select a type solely because it produces a higher R-squared value.
Can I show the trendline equation in Excel?
Yes. Select More Trendline Options to open the Format Trendline pane, then select Display Equation on chart. You can also select Display R-squared value on chart. The equation shown on the chart may be rounded.
Does a trendline change my worksheet data?
No. It is a chart element calculated from the selected series. It does not replace, rewrite, or fill in the original cell values.
Related
- Excel WEEKDAY: Get the Day of the Week from a Date
- Excel Weekday Name: Show the Day from Any Date in Excel
- Excel New Sheet Shortcut: Add a Worksheet in Seconds
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Excel Combo Chart Bar Width: How to Change Gap WidthTo change bar width in an Excel combo chart, select a column series, open Format Data Series, and…
- Excel Pivot Table: Add a Field to Filters and RowsTo add a PivotTable field to both a filter and a row, open the PivotTable Fields pane and…
- Excel Waterfall Chart Total Bar: Set It CorrectlyTo make a bar in an Excel waterfall chart represent a total, right-click that data point and choose…
- Excel Waterfall Chart: Show a Total at the EndTo show a final total in an Excel waterfall chart, select the last bar, right-click it, and choose…
- Excel Payment Chart: Build a Loan Schedule and GraphAn Excel payment chart is usually a loan amortization schedule paired with a graph showing how payments are…
- Excel Waterfall Chart Total Column: How to Add OneTo make a column a total in an Excel waterfall chart, select that individual column, right-click it, and…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.