Regression Line: SLOPE & INTERCEPT

Excel Formulas › Statistics

All versionsSLOPE

Fit a straight line to data and read off its equation. SLOPE gives the rate of change and INTERCEPT the starting value — together, y = slope·x + intercept.


Quick formula: slope and intercept for y (B) on x (A):
=SLOPE(B2:B100, A2:A100) =INTERCEPT(B2:B100, A2:A100)
Order is (known_ys, known_xs). The slope is the change in y per unit x; the intercept is y at x = 0.

Functions used (tap for the full reference guide):

The example

The best-fit line’s equation.

AB
1CoefficientValue
2Slope2.5
3Intercept10

The formula

The formula:

=SLOPE(ys, xs) | =INTERCEPT(ys, xs) // y = 2.5x + 10

How it works

How it works:

  1. SLOPE(known_ys, known_xs) is the line’s steepness — how much y changes per unit of x.
  2. INTERCEPT(known_ys, known_xs) is where the line crosses the y-axis (y when x = 0).
  3. Predict with =slope*x + intercept, or use FORECAST.LINEAR(x, ys, xs) in one step.
  4. Note the argument order: ys first, xs second — easy to reverse by mistake.

Check the fit: pair these with RSQ(ys, xs) — the R-squared — to see how well the line explains the data. A slope is only meaningful if the relationship is reasonably linear.

Try it: interactive demo

Live demo

Pairs “x,y”.

Slope · Intercept

Variations

Predict y

One step:

=FORECAST.LINEAR(x, ys, xs)

R-squared

Fit quality:

=RSQ(ys, xs)

Full stats (LINEST)

Coefficients + errors:

=LINEST(ys, xs, TRUE, TRUE)

Pitfalls & errors

ys first, xs second. Reversing the arguments flips the relationship.

Linearity assumed. A slope on curved data is misleading; check the R-squared and a scatter plot.

Equal-length ranges. xs and ys must have the same count.

Practice workbook

📊
Download the free Regression Line: SLOPE & INTERCEPT practice workbook
A regression sheet with predict, R-squared, and LINEST variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I find the slope and intercept of data in Excel?
Use =SLOPE(known_ys, known_xs) and =INTERCEPT(known_ys, known_xs). The line is y = slope·x + intercept.
How do I predict a value from the line?
Compute =slope*x + intercept, or use =FORECAST.LINEAR(x, known_ys, known_xs) in one step.
How do I check if the line fits well?
Use =RSQ(known_ys, known_xs) for R-squared — closer to 1 means a better linear fit.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Linear forecast · R-squared · Correlation

Function references: SLOPE · INTERCEPT