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
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
Arguments
| Argument | Required? | What it does |
|---|---|---|
| known_y's | Yes | The values you want to predict (for example, sales). |
| known_x's | Yes | The 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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Ad spend ($k) | Sales ($k) | Measure | Result |
| 2 | Jan | 2 | 21 | Slope | 4.1071 |
| 3 | Feb | 3 | 25 | Intercept | 12.2143 |
| 4 | Mar | 5 | 33 | ||
| 5 | Apr | 4 | 28 | ||
| 6 | May | 6 | 38 | ||
| 7 | Jun | 7 | 40 | ||
| 8 | Jul | 8 | 46 | ||
| 9 | Aug | 5 | 31 |
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.
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
- Related functions: INTERCEPT, RSQ, FORECAST.LINEAR, TREND, LINEST.

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.