Calculating Slope Excel

There are two ways to “calculating slope excel”: the quick way you copy and the durable way you understand. This page gives you both. The exact Excel answer is above; below, we build the small mental model that makes the fix stick, so the next variation of the same problem solves itself.

Exact answer

In Excel: use =SLOPE(known_ys, known_xs) and =INTERCEPT(known_ys, known_xs) — together they give the two coefficients of the best-fit straight line, y = slope × x + intercept.

On this page8

Syntax

=SLOPE(known_ys, known_xs) and =INTERCEPT(known_ys, known_xs)

Arguments

Argumentrequired / optionalDescription
known_ysrequiredThe dependent values — the thing being predicted.
known_xsrequiredThe independent values, the same size as known_ys.

Related functions

FORECASTCORRELTREND
Annotated stepsExcel
1

Select a cell for the slope and type =SLOPE(.

2

Select the y values (the outcome) FIRST, then a comma, then the x values.

3

Repeat in a second cell with =INTERCEPT and the same argument order.

4

Combine them as intercept + slope × x to predict any new value.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

Need it as an auditable file?

Ships inside the linked template — formula-driven, unlocked, audit-ready.

View template

What this does

SLOPE and INTERCEPT return the two numbers that define the least-squares regression line through a set of points. SLOPE is the rate of change — how much y moves per unit of x — and INTERCEPT is where the line crosses at x = 0. Written out they reproduce exactly the trendline equation a chart displays, which makes them the way to use a fitted line in calculations rather than merely look at one. Watch the argument order: the y values come first, which is the reverse of how most people say "x against y". The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “calculating slope excel”. Start on a copy or a tiny sample, keep the affected cells visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a calculation you can defend to a CFO or an auditor, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

Units produced in B2:B40 and total cost in C2:C40: =SLOPE(C2:C40, B2:B40) returns the variable cost per unit and =INTERCEPT(C2:C40, B2:B40) the fixed cost. Predicting the cost of 250 units is then =INTERCEPT(...) + SLOPE(...)*250, which is what FORECAST.LINEAR does in a single call. SLOPE and INTERCEPT take a chart trendline out of the picture and put it into the model, where it can drive actual calculations. One habit worth forming early: name the cells that hold your inputs, so the formula reads in plain language instead of a string of cell addresses. A reviewer — or you in three months — can then follow the logic without decoding what B7 and D2 were supposed to mean, which is most of what makes a sheet maintainable.

In Google Sheets

If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. Here is the takeaway for “calculating slope excel”: copy the answer if you are busy, but if you have a spare few minutes, rebuild the example in Excel yourself with the tool above open beside it. That single pass — type it, run it, watch the result move when you change an input — is what turns a formula you found into a technique you trust. Keep your inputs labelled and referenced, never hard-coded, and the same sheet stays correct and auditable as it grows. Done that way, you will not need to look this up again, and you will be the person others ask.

Common mistakes

  • Reversing the arguments — y comes first in both functions, and swapping them silently returns a different line.
  • Extrapolating far beyond the observed x range, where a straight line has no support from the data.
  • Fitting a line to plainly curved data; check the scatter plot before trusting either coefficient.

Frequently asked questions

Which argument comes first?

The y values — the thing being predicted. =SLOPE(known_ys, known_xs).

How do I get the trendline equation from a chart into cells?

SLOPE and INTERCEPT return exactly those two coefficients, so you can use the fitted line in formulas instead of reading it off the chart.

How do I predict a value?

=INTERCEPT(ys,xs) + SLOPE(ys,xs)*newX, or the shorter =FORECAST.LINEAR(newX, ys, xs).