The quickest way to add a line of best fit in Excel

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 on the data series in your chart, selecting "Add Trendline", and choosing "Linear" from the menu. The line appears when ready on your chart.

The whole process takes about 30 seconds once your chart is already built. You do not need to calculate anything yourself — Excel does the math and draws the line for you.

Key Takeaways

  • Right-click directly on one of your data points (the dots or bars on the chart), not on the chart background or axis.
  • Select "Add Trendline" from the menu, then choose "Linear" to get a straight line of best fit.
  • The line appears on your chart when ready; you can format it by changing color, thickness, or style in the same menu.
  • If you want to see the equation or R-squared value (which measures how well the line fits), check the boxes in the Trendline Options panel.

Step-by-step: adding a trend line to an existing chart

Start with a chart that already has your data plotted. This works with scatter plots, line charts, column charts, and bar charts. The chart needs to be selected (you should see a border around it).

Right-click on one of your data points — the actual dots, bars, or markers on the chart itself, not the background. A menu appears. Click "Add Trendline". A panel opens on the right side of your screen labeled "Trendline Options".

In that panel, make sure "Linear" is selected (it usually is by default). You will see the line appear on your chart when ready. The line runs through your data in the direction that minimizes the distance from all points to the line.

If you want to close the panel, click the X in the top right corner. The trend line stays on your chart.

Showing the equation and R-squared value

The equation of the line and the R-squared value tell you how well the line fits your data. The equation looks like y = mx + b (where m is the slope and b is the y-intercept). The R-squared value ranges from 0 to 1; closer to 1 means the line fits your data very well, and closer to 0 means the fit is loose.

To display these, right-click on the trend line itself (not the data points this time) and select "Format Trendline". In the panel that opens, scroll down and check the boxes for "Display Equation on chart" and "Display R-squared value on chart". Both values appear as text on your chart, usually near the trend line.

You can click and drag these text boxes to move them if they overlap with your data or legend.

Other trend line types and when to use them

Linear is the most common choice and works well when your data roughly follows a straight line. But Excel offers other options if your data has a different pattern.

Exponential trend lines curve upward or downward and work for data that grows or shrinks at an accelerating rate — like bacterial growth or radioactive decay. Polynomial trend lines have bends and work for data with peaks and valleys, like seasonal sales or temperature cycles. Power trend lines also curve and work for relationships where one variable depends on another raised to a power, like the relationship between area and side length.

To try a different type, right-click on the trend line, select "Format Trendline", and choose a different option from the list on the left. The line updates on your chart so you can see which type fits best. Most of the time, linear is what you need.

Formatting the appearance of your trend line

By default, the trend line is a thin blue line. You can change its color, thickness, and style to make it stand out or match your chart design.

Right-click on the trend line and select "Format Trendline". In the panel, click the paint bucket icon (usually labeled "Fill & Line" or similar). You will see options for line color, width, and dash style. Choose what you want and the trend line updates when ready on your chart.

A thicker line or a contrasting color makes the trend easier to see, especially if your data points are dense or your chart will be printed in black and white.

Removing a trend line

If you add a trend line and decide you do not want it, right-click on the trend line itself and select "Delete". It disappears from the chart. Your data points stay intact.

You can add and remove trend lines as many times as you want without affecting your underlying data or chart structure.

Frequently Asked Questions

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

Yes. You can add a separate trend line for each data series if your chart has multiple series. Right-click on each series one at a time and add a trend line to each. Each line can have its own format and equation.

What does the R-squared value actually mean?

R-squared tells you what percentage of the variation in your data is explained by the trend line. An R-squared of 0.85 means the line accounts for 85% of the pattern; an R-squared of 0.40 means the line only captures 40% of it. Higher is better, but even a low R-squared can be useful for showing the general direction of your data.

Does the trend line change if I add new data to my chart?

Yes. Excel recalculates the trend line automatically whenever you add or remove data points from the chart. The line adjusts to fit all the data you currently have.

Can I use a trend line in a pie chart or doughnut chart?

No. Trend lines only work in charts that have an x-axis and y-axis — scatter plots, line charts, column charts, bar charts, and area charts. Pie and doughnut charts do not have axes, so the trend line feature is not available.