Adding a trendline shows the direction your data is moving

A line of best fit (also called a trendline) is a straight line drawn through your data points to show the overall pattern or direction. In Excel, you add it by selecting your chart, then using the trendline tool to let Excel calculate and draw the line automatically. The line helps you see whether values are going up, down, or staying flat — even when individual data points scatter all over the place.

You need a chart already made in Excel before you can add a trendline. If you have raw numbers in columns but no chart yet, create a scatter chart or line chart first, then follow the steps below.

Key Takeaways

  • A trendline works only on charts that are already in your spreadsheet — you cannot add one to raw data in cells.
  • Right-click the data series (the dots or line on your chart) and select "Add Trendline" to open the trendline menu.
  • Excel offers a linear trendline by default, which works for most situations where you want to see if data is rising or falling.
  • The trendline equation and R-squared value tell you how well the line fits your actual data points.

Create or open a chart in Excel first

Before you can add a line of best fit, you need a chart. If you already have one on your spreadsheet, skip to the next section. If not, select the cells containing your data (including headers), go to the Insert tab at the top, and click Chart. Excel will show you chart type options — choose Scatter or Line, depending on your data.

A scatter chart (also called XY chart) is the most common choice for a line of best fit because it shows individual data points as dots, and the trendline passes through or near them. A line chart connects the dots with lines, which can make the trendline harder to see. Either works, but scatter is clearer for this purpose.

Right-click the data series and select Add Trendline

Click on your chart to select it. You will see the chart get a border around it. Now right-click directly on one of the data points (a dot on a scatter chart, or a point on the line of a line chart). A menu will appear. Look for the option that says "Add Trendline" and click it.

If you right-click in the wrong spot — on the background of the chart instead of on a data point — you will get a different menu. Just try again and click directly on a dot or line.

Choose linear trendline for most situations

After you click "Add Trendline," a panel will open on the right side of your screen (or a dialog box, depending on your Excel version). At the top of this panel, you will see trendline type options. Linear is selected by default and is the right choice for most data — it draws a straight line that shows whether your values are generally rising, falling, or staying level.

Other options like Exponential, Power, or Polynomial exist for specialized situations where data curves rather than moving in a straight line. Unless you have a specific reason to use one of those, stick with Linear. The linear trendline is the standard "line of best fit" that most people mean when they ask for one.

Display the equation and R-squared value

In the trendline panel, look for checkboxes labeled "Display Equation on chart" and "Display R-squared value on chart." Check both of these boxes. The equation will appear on your chart in the form y = mx + b, where m is the slope (how steep the line is) and b is where it crosses the y-axis. The R-squared value (ranging from 0 to 1) tells you how closely the trendline matches your actual data — closer to 1 means a better fit.

You do not have to display these values, but they are useful. The equation lets you predict future values by plugging in a new x number. The R-squared value shows you whether the trendline is actually meaningful or whether your data is too scattered for a straight line to represent it well.

Adjust the trendline appearance if needed

The trendline appears on your chart as a line, usually in a different color from your data points. If you want to change how it looks — make it thicker, change its color, or make it dashed instead of solid — right-click the trendline itself (not the data points) and select "Format Trendline." A panel will open where you can adjust the line color, width, and style.

Most of the time, the default appearance is fine and you do not need to change it. The trendline is there to help you see the pattern, not to be decorative. If your chart is going into a presentation or report, you might want to make the trendline a different color so it stands out clearly from the data points.

Extend the trendline to predict future values

In the trendline panel, you will see options to extend the line forward or backward beyond your actual data. Under "Forecast," you can enter a number of periods to extend the line into the future. This is useful if you want to see where the trend would go if it continues at the same rate.

For example, if your data covers January through June and you want to see where the trend would be in September, you can set the forecast to extend 3 periods forward. The extended part of the line will usually appear as a dashed line to show it is a prediction, not actual data. Remember that this is only a prediction based on the pattern so far — real data may not follow the trend.

Frequently Asked Questions

Can I add a trendline to a chart that already has multiple data series?

Yes. Right-click on the specific data series you want a trendline for, and Excel will add a trendline only to that series. You can add separate trendlines to different series if your chart has more than one.

What does the R-squared value mean?

R-squared measures how well the trendline fits your data, on a scale from 0 to 1. A value of 0.95 or higher means the line fits very closely. A value below 0.7 means your data is scattered enough that a straight line may not be the best way to show the pattern.

How do I remove a trendline I no longer want?

Right-click the trendline itself and select Delete. The trendline will disappear, but your chart and data stay the same.

Can I use a trendline with a bar chart or pie chart?

No. Trendlines only work with scatter charts, line charts, and a few other types that show numerical values on both axes. Bar and pie charts do not support trendlines.

What if my data does not look like a straight line at all?

If your data curves sharply or follows a pattern that is clearly not linear, you can try other trendline types like Polynomial or Exponential. Right-click the trendline, select "Format Trendline," and try a different type. Check the R-squared value to see if it improves the fit.