Adding a trend line to your Excel chart in three steps

A line of best fit (also called a trend line) is a straight line drawn through your data points to show the overall direction or pattern. In Excel, you add it by right-clicking the data series on your chart, selecting "Add Trendline", and choosing the type that matches your data — usually "Linear" for a straight line.

The line itself doesn't pass through every point. Instead, it minimizes the distance between itself and all the points combined, which is why it's useful for spotting trends even when individual data points scatter. Once added, you can format it, display its equation, and show how well it fits your data with an R-squared value.

Key Takeaways

  • Create a scatter chart or line chart with your data first — the trend line only works on charts, not raw data in cells.
  • Right-click the data series (the dots or line on the chart), not the chart background, then select "Add Trendline" from the menu.
  • Linear is the most common trend line type and works for data that moves steadily up or down.
  • Display the equation and R-squared value on your chart to see the trend line's formula and how closely it matches your actual data.

Creating a chart before you add the trend line

You cannot add a trend line to raw data in cells — it only works on charts. Start by selecting your data (both the X and Y values), then insert a chart. Go to the Insert tab, click Chart, and choose either a Scatter chart (best for trend lines) or a Line chart.

A scatter chart is usually the clearest choice because it shows each data point as a dot, making the trend line's path obvious. If your data is already in a chart and you're ready to add the trend line, skip to the next section.

Right-clicking the data series to add the trend line

Click on the chart to select it, then 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). Do not right-click the chart background or the axes — you need to click the data itself.

A menu will appear. Select "Add Trendline" (in newer Excel versions) or "Format Data Series" then "Trendline" (in older versions). The Trendline pane or dialog box will open on the right side of the screen or as a separate window.

Choosing the trend line type

Linear is the default and the right choice for most data. It draws a straight line and works when your data moves steadily up or down. If your data curves — for example, it rises quickly at first then levels off — you may want Exponential or Power instead.

Other options include Logarithmic (data that rises fast then flattens), Polynomial (data that curves or changes direction), and Moving Average (which smooths out short-term bumps). For most business and scientific data, Linear is sufficient. Select the type you want, and Excel will draw the line immediately on your chart.

Displaying the equation and R-squared value

The equation tells you the exact formula of the trend line. The R-squared value (ranging from 0 to 1) tells you how well the line fits your data — closer to 1 means the line matches your points very closely, while closer to 0 means the points scatter widely around it.

To show both, check the boxes labeled "Display Equation on chart" and "Display R-squared value on chart" in the Trendline pane. The equation will appear as something like "y = 2.5x + 10", and the R-squared will show as "R² = 0.87". These values help you understand whether the trend line is a reliable summary of your data.

Formatting the trend line's appearance

Once the trend line is on your chart, you can change its color, thickness, and style. Right-click the trend line itself (not the data points), then select "Format Trendline". A pane will open where you can adjust the line color under "Line" and its width under "Line Style".

You can also make the trend line dashed instead of solid, which helps it stand out from the actual data. These changes are purely visual and do not affect the math behind the line.

Removing or replacing a trend line

If you want to remove the trend line, right-click it and select "Delete". If you want to try a different type, right-click the trend line, select "Format Trendline", and change the type in the pane that opens. You can have multiple trend lines on the same chart if you want to compare different patterns.

For example, you might add a Linear trend line to see the overall direction and a Moving Average to see short-term patterns side by side.

Frequently Asked Questions

What's the difference between a scatter chart and a line chart for trend lines?

A scatter chart plots each data point as a dot and is clearest for showing how a trend line fits. A line chart connects the dots with lines, which can make the trend line harder to see. For trend lines, scatter charts are usually better, but both work.

Can I add a trend line to data that's not in a chart yet?

No. You must create a chart first. Select your data, go to Insert > Chart, choose your chart type, and then add the trend line to the finished chart.

What does an R-squared value of 0.95 mean?

It means the trend line explains 95% of the variation in your data — the points follow the line very closely. Values above 0.8 are generally considered a good fit. Below 0.5 suggests the trend line may not be a reliable summary of your data.

Can I add a trend line to a chart with multiple data series?

Yes. Right-click each data series separately and add a trend line to each one. Each series can have its own trend line with its own color and equation.

Why does my trend line look wrong?

Check that you right-clicked the data series itself, not the chart background. Also verify that your data is sorted correctly — if X values jump around randomly, the trend line may look strange even though it's mathematically correct.