What a line of best fit does, and when to use it

A line of best fit (also called a trend line) is a straight line drawn through the points on your chart that shows the general direction your data is moving. Excel calculates where that line should go based on all your data points, then draws it for you. The line itself usually doesn't touch every point — it sits roughly in the middle of them, showing the overall pattern.

You use a line of best fit when you want to see whether something is going up, down, or staying flat over time. For example, if you have monthly sales numbers, a trend line shows whether sales are generally increasing or decreasing, even if individual months bounce around. It's useful for spotting patterns that aren't obvious when you're just looking at the raw numbers.

A line of best fit only works on scatter charts and line charts where you have two related sets of numbers — one for the horizontal axis (like months) and one for the vertical axis (like sales). It won't work on bar charts or pie charts.

Key Takeaways

  • Right-click any data point on your chart, then select "Add Trendline" from the menu that appears.
  • Excel defaults to a linear trend line, which works for most situations where data moves in a generally straight direction.
  • You can display the equation and R-squared value on your chart to see how well the line fits your actual data.
  • A trend line is a visual aid only — it doesn't change your underlying data or create new numbers in your spreadsheet.

Creating your chart before adding the trend line

Before you can add a line of best fit, you need a chart already built in Excel. Select the data you want to chart (both columns — the labels and the numbers), then go to the Insert tab and choose your chart type. A scatter chart or line chart works best for trend lines.

Once your chart is on the spreadsheet, you're ready to add the trend line. The chart doesn't have to be perfect — you can adjust colors, labels, and other details later. What matters is that your data is plotted and visible.

The three-step process to add a trend line

Click on your chart to select it. You'll see a border around the chart with small squares at the corners and edges.

Right-click on any of the data points (the dots or line itself) on your chart. A menu will pop up. Look for the option that says "Add Trendline" and click it. If you don't see that option, make sure you right-clicked directly on a data point, not on the chart background.

A panel called "Format Trendline" will open on the right side of your screen. Excel has already selected "Linear" as the default type, which is what you want for most situations. You can leave it as is and close the panel, or adjust the settings if you want to see more information on your chart.

Showing the equation and fit quality on your chart

When the Format Trendline panel is open, you'll see checkboxes for "Display Equation on chart" and "Display R-squared value on chart." Checking these boxes adds text to your chart that shows the mathematical equation of the line and a number called R-squared.

The R-squared value tells you how closely the trend line matches your actual data. It ranges from 0 to 1. A value closer to 1 (like 0.95) means the line fits your data very well. A value closer to 0 (like 0.40) means your data points are scattered all over, and the line is just a rough guess at the direction. Neither is wrong — it just tells you how much variation exists in your data.

The equation shows the mathematical formula of the line. You don't need to understand it to use the trend line, but it's there if you want to predict future values by plugging in new numbers.

Choosing a different trend line type

Linear is the default and works for most data. But if your data curves instead of moving in a straight line, you can try other types. In the Format Trendline panel, you'll see options like Exponential, Logarithmic, Polynomial, and Power.

Exponential trend lines work when something is growing faster and faster (like bacteria multiplying). Polynomial trend lines work when your data dips and rises (like sales that peak in summer and drop in winter). Most of the time, linear is the right choice — only switch if you can see that your data clearly follows a curved pattern instead of a straight one.

If you're not sure which type to use, stick with linear. It's simple, and it shows the overall direction clearly.

Removing or adjusting a trend line you've already added

If you want to remove the trend line, right-click on it (the line itself, not the data points) and select "Delete." The trend line disappears, but your chart and data stay the same.

To adjust the trend line after you've added it, right-click on it again and select "Format Trendline." The panel opens and you can change the type, show or hide the equation, or adjust the color and thickness of the line itself.

Frequently Asked Questions

Does adding a trend line change my actual data?

No. A trend line is purely visual — it's drawn on top of your chart to show a pattern. Your spreadsheet data stays exactly the same. The trend line doesn't create new numbers or modify existing ones.

Can I add more than one trend line to the same chart?

Yes. Right-click on a different data series (if you have multiple series on one chart) and add a trend line to that one too. Each series can have its own trend line. This is useful when you're comparing two related things, like sales and expenses over the same time period.

What does R-squared actually mean in plain terms?

R-squared tells you how much of your data's variation the trend line explains. An R-squared of 0.85 means the trend line accounts for 85% of why your numbers go up and down — the other 15% is random variation or factors the trend line doesn't capture. Higher is generally better, but even lower values can be useful for spotting overall direction.

Why does my trend line look like it doesn't go through any of my data points?

That's normal. A line of best fit is calculated to minimize the distance from all points combined, not to pass through specific ones. It's a compromise that shows the overall pattern. If your data is very scattered, the line might miss every single point and still be correct.