Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Linear Regression Chart Excel: Step-by-Step Guide

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To create a linear regression chart in Excel, you first need a scatter plot of your data, then add a trendline with the equation and R-squared value. This guide walks you through the exact steps in Excel 2016–2024 (Microsoft 365), and the menus are nearly identical across versions.

What You'll Need

  • Microsoft Excel (desktop version recommended; the web version has limited chart options)
  • Two columns of numeric data: one for the independent variable (X, e.g., time) and one for the dependent variable (Y, e.g., sales)
  • Your data should be arranged in columns, with headers in the first row (optional but helpful)

Step-by-Step

  1. Prepare your data. Put your X values in one column (e.g., Column A) and your Y values in the adjacent column (e.g., Column B). Ensure there are no blank rows or text in the numeric ranges.
  2. Select your data. Click and drag to highlight both columns, including the headers if you have them. Do not include any other columns.
  3. Insert a scatter chart. Go to the Insert tab on the ribbon. In the Charts group, click the scatter plot icon (it looks like a cluster of dots). Choose the first option, Scatter (not the one with lines). This creates a chart with your data points.
  4. Add a trendline. Click anywhere on the chart to select it. You’ll see a small plus sign (+) button at the top-right corner of the chart. Click it, then check the box next to Trendline. Excel adds a linear trendline by default (straight line).
  5. Display the equation and R². Right-click on the trendline itself (the line, not the data points) and select Format Trendline. In the pane that opens on the right, scroll down and check the boxes for Display Equation on chart and Display R-squared value on chart. The equation (like y = 2x + 5) and R² value (like 0.98) appear on the chart.
  6. Customize the chart (optional). With the chart selected, use the Chart Design tab to change the chart title, axis titles, and colors. To add axis titles, click the plus sign (+) button again, check Axis Titles, then click on the placeholder text to edit it.
  7. Move the equation if needed. The equation and R² text are text boxes. Click and drag them to a less cluttered area of the chart.
  8. Save or copy. Your chart is now ready. You can copy it to Word or PowerPoint, or save the workbook.

Common Mistakes

  • Using a line chart instead of a scatter plot. A line chart treats X values as categories, not numbers, so the trendline will be incorrect. Always use a scatter plot.
  • Selecting non-adjacent columns. If your X and Y data are not side by side, hold Ctrl while selecting each column. But for simplicity, keep them adjacent.
  • Including blank cells or text. Excel will ignore them, but it can cause gaps or misalignment. Clean your data first.
  • Forgetting to check “Display Equation”. The trendline appears without the equation unless you explicitly enable it in the Format Trendline pane.
  • Using a polynomial or moving average trendline by mistake. The default is linear, but if you changed it earlier, right-click the trendline, choose Format Trendline, and select Linear under Trendline Options.

Tips

  • R² (R-squared) tells you how well the line fits: 1 is perfect, 0 is no fit. A value above 0.7 is often considered decent, but it depends on your field.
  • To predict values beyond your data, you can extend the trendline forward. In the Format Trendline pane, under Forecast, enter a number in Forward (e.g., 5 periods).
  • If your data is not linear, try other trendline types (exponential, logarithmic) and compare R² values.
  • To see the underlying data for the trendline (slope and intercept), you can use the LINEST function, but the chart method is simpler for visual analysis.
  • Keep your chart simple: remove gridlines if they clutter, and use a clear title that explains what the chart shows.

Troubleshooting

If the trendline doesn’t appear: Make sure you have a scatter chart, not a line chart. If you already have a line chart, delete it and re-insert a scatter plot. Also, check that you have at least two data points (though more is better).

If the equation looks wrong (e.g., shows “y = 1E+05x”): That’s scientific notation for very large numbers. Right-click the equation text box, choose Format Trendline Label, go to Number, and choose Number instead of Scientific.

If the R² value is missing: Go back to the Format Trendline pane and check the box for Display R-squared value on chart. It’s a separate checkbox from the equation.

If the chart doesn’t update when you change data: Excel usually updates automatically. If not, check that your chart is based on the correct range: right-click the chart, choose Select Data, and verify the ranges.

If the trendline is not straight: Right-click the trendline, choose Format Trendline, and under Trendline Options select Linear.

If you’re using Excel for the web: The web version supports scatter charts and trendlines, but the Format Trendline pane is more limited. If you can’t find the equation option, open the file in the desktop app.

Frequently Asked Questions

Can I create a linear regression chart without a scatter plot?

No, you need a scatter plot because it treats both axes as numeric. A line chart will not give you a correct regression trendline.

How do I add the regression equation to the chart?

Right-click the trendline, choose Format Trendline, and check Display Equation on chart. The equation appears as text on the chart.

What does the R² value mean?

R² (coefficient of determination) shows the proportion of variance in the Y variable explained by the X variable. A value of 1 means a perfect fit; 0 means no linear relationship.

Can I use linear regression for non-linear data?

No, linear regression assumes a straight-line relationship. If your data curves, try a polynomial or exponential trendline instead.

How do I change the trendline from linear to another type?

Right-click the trendline, choose Format Trendline, and select a different type under Trendline Options (e.g., Exponential, Logarithmic, Polynomial).

Why is my trendline not showing on the chart?

Make sure you have a scatter chart. If you do, click the chart, click the plus sign, and check Trendline. If it still doesn’t show, right-click any data point and choose Add Trendline.