SLOPE Function

Returns the slope of the best-fit straight line through data points.

Category

Statistical

Available in

All versions, Microsoft 365

Returns

A number

Taught hands-on in Data Analytics · Relationships & Trends module

Overview

SLOPE fits the least-squares straight line through your points and returns its slope: how much y changes, on average, when x goes up by 1.

Together with INTERCEPT it gives the line y = slope × x + intercept — the same line as a chart's linear trendline. Pairs where either value isn't a number are left out.

Syntax

=SLOPE(known_y's, known_x's) Explain

Arguments

ArgumentRequired?What it does
known_y'sYesThe values you want to predict (for example, sales).
known_x'sYesThe values that drive them (for example, ad spend), the same size as known_y's.

Examples

Example 1 — Sales gained per $1k of advertising

Sales (y) in C, ad spend (x) in B, both in $ thousands.

E2fx=SLOPE(C2:C9,B2:B9)
ABCDE
1MonthAd spend ($k)Sales ($k)MeasureResult
2Jan221Slope4.1071
3Feb325Intercept12.2143
4Mar533
5Apr428
6May638
7Jun740
8Jul846
9Aug531
=SLOPE(C2:C9,B2:B9) Explain

Each extra $1k of advertising has gone with about $4.1k more sales.

Example 2 — Trend per period

Use the period numbers as x to get the average change per month.

=SLOPE(C2:C9,SEQUENCE(8)) Explain

With months 1–8 as x, sales rose by about $2.45k a month on average.

Common mistakes

  • y first, then x. Swapping the ranges fits a different line: =SLOPE(B2:B9,C2:C9) gives about 0.24 (ad spend per $1k of sales), not 4.11.
  • #DIV/0! All the x values are the same, so no line can be fitted.
  • #N/A The two ranges are different sizes.

Notes

Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.