How to Add a Regression Line in Excel (Trendline Guide)

A regression line turns a cloud of data points into something meaningful — a visual representation of the relationship between two variables. Whether you're analyzing sales trends, tracking project performance, or exploring correlations in scientific data, Excel makes it reasonably straightforward to add one. That said, how you add it, and which type you choose, depends on your data structure and what you're actually trying to show.

What a Regression Line Actually Does

A regression line — called a trendline in Excel — fits a mathematical line or curve through your scatter plot data to reveal the overall direction and strength of a relationship. The most common type is a linear trendline, which draws a straight line through the data using the least squares method. This minimizes the total distance between the line and each data point.

Excel can also display the R-squared value (R²), which tells you how well the trendline fits the data. An R² of 1.0 is a perfect fit; closer to 0 means the trendline explains very little of the variation in your data.

Step-by-Step: Adding a Regression Line to an Excel Chart

Before you can add a trendline, you need a chart. A scatter plot (XY Scatter) is the standard choice for regression analysis because it treats both axes as numeric values with a true relationship between them.

Step 1 — Create Your Chart

  1. Select your two columns of data (independent variable in column A, dependent variable in column B)
  2. Go to Insert → Charts → Scatter
  3. Choose the basic scatter plot (dots only, no lines)

Step 2 — Add the Trendline

Once your chart is created:

  1. Click on any data point in the chart to select the data series
  2. Right-click and choose "Add Trendline"
  3. The Format Trendline panel opens on the right side

Alternatively, click the "+" icon that appears beside the chart when selected, check Trendline, and click the arrow to expand options.

Step 3 — Choose Your Regression Type

This is where user needs diverge significantly:

Trendline TypeBest ForRelationship Shape
LinearSteady increase or decreaseStraight line
ExponentialGrowth that accelerates over timeCurved upward
LogarithmicRapid change that levels offCurved, flattening
PolynomialFluctuating data with peaks/valleysWavy curve
PowerData that rises at a steady rateCurved
Moving AverageSmoothing out noisy time-series dataRolling average line

For most business and general-use cases, Linear is the appropriate starting point.

Step 4 — Display the Equation and R-Squared Value

In the Format Trendline panel, scroll down and check:

  • Display Equation on chart
  • Display R-squared value on chart

The equation shows you the slope and intercept of the line (in the form y = mx + b). The R² value tells you how reliable that line is as a predictor.

📊 Using the Analysis ToolPak for Full Regression Output

Adding a visual trendline gives you the line itself, but if you need the full regression statistics — coefficients, standard errors, p-values, confidence intervals — Excel's built-in Analysis ToolPak is the right tool.

To enable it:

  1. Go to File → Options → Add-ins
  2. At the bottom, set the dropdown to Excel Add-ins and click Go
  3. Check Analysis ToolPak and click OK

Then:

  1. Go to Data → Data Analysis
  2. Select Regression from the list
  3. Set your Input Y Range (dependent variable) and Input X Range (independent variable)
  4. Choose an output location and click OK

This produces a full statistical table — far more information than the chart trendline alone provides. Whether you need this level of detail depends entirely on your purpose: a quick visual trend versus a rigorous statistical analysis are different goals requiring different outputs.

Variables That Affect Your Approach 🔍

Several factors shape which method makes sense:

  • Data type — Time-series data (dates on the X-axis) behaves differently from true XY numeric relationships. A line chart trendline works for time-series; a scatter plot is better for correlations between two numeric variables.
  • Number of variables — Excel's built-in tools handle simple (one predictor) regression well. Multiple regression with several X variables is possible through the Analysis ToolPak but requires more careful setup.
  • Excel version — The trendline interface and Analysis ToolPak availability are consistent across modern versions (Excel 2016 and later, including Microsoft 365), but the exact menu layout may vary slightly between desktop and Excel Online. Note: Excel Online has limited trendline functionality compared to the desktop application.
  • Chart type — Trendlines are only available on specific chart types: scatter plots, bar/column charts, line charts, and bubble charts. They are not available on pie charts, radar charts, or 3D charts.
  • Data quality — Outliers, missing values, or non-numeric entries in your dataset will affect how the trendline fits. Cleaning your data before adding a trendline matters more than most users expect.

When a Linear Trendline Misleads

A straight regression line assumes a linear relationship exists in your data. If your data follows a curve, a linear trendline will still draw — it just won't represent reality accurately. A high R² on a linear trendline with curved data doesn't mean the relationship is linear; it might just mean the data happens to trend in one direction overall.

Checking the residual plot (available through the Analysis ToolPak regression output) reveals whether a linear model is appropriate or whether a polynomial or other fit would better match your data's actual shape.

The right regression type, the right chart, and the right level of statistical output all hinge on what your data looks like and what question you're trying to answer — which is something only you can determine by looking at your specific dataset.