Example 1
Sales per unit of ad spend
B8 =SLOPE(C2:C6,B2:B6)
Result: 2.8
Sales is y and ad spend is x. Each extra unit of ad spend goes with 2.8 more units of sales on the best-fit line.
B8 =SLOPE(C2:C6,B2:B6) returns 2.8
Returns the slope of the straight line that best fits your data: how much y changes for each one-unit increase in x.
Syntax
=SLOPE(, )
All versions of Excel, including Excel for Microsoft 365 and Excel for the web.
Try it
Edit the formula in B8 or change the inputs. The sheet recalculates as you type.
B8 =SLOPE(C2:C6,B2:B6) returns 2.8
SLOPE fits a straight line through your data using least squares and returns its gradient. The slope is the answer to "for every extra unit of x, how much more y do we get?". It turns a scatter of points into a rate: sales per advertising pound, cost per kilometre, or units gained per month.
SLOPE takes y first, then x: =SLOPE(known_ys, known_xs). The y values are the thing you are explaining, such as sales, and the x values are what you think drives it, such as ad spend. This is the reverse of what many people expect, and swapping them returns a different number without any error.
Ad spend of 10, 20, 30, 40 and 50 against sales of 120, 150, 170, 210 and 230 gives =SLOPE(C2:C6, B2:B6) = 2.8. Each extra unit of ad spend goes with about 2.8 more units of sales. Swapped, =SLOPE(B2:B6, C2:C6) returns about 0.35, which answers a different question: how much ad spend goes with a one-unit rise in sales.
A positive slope means y rises with x. A negative slope means y falls as x rises, such as units sold against price. A slope near zero means the best-fit line is nearly flat, so x tells you little about y.
Use time as x to get the average change per period. For months numbered 1 to 6, =SLOPE(B2:B7, A2:A7) returns the average monthly change in the series. If your x values are dates, the slope is the change per day, so multiply by 30 or 365 for a monthly or yearly figure.
The slope equals the correlation multiplied by the ratio of the spreads: CORREL(y,x) × STDEV.S(y) / STDEV.S(x). SLOPE and INTERCEPT together define the line y = intercept + slope × x. FORECAST.LINEAR uses both to predict a value for a new x. CORREL tells you how well the line fits.
The two ranges must have the same number of values, or SLOPE returns #N/A. If every x value is identical, the line is vertical and SLOPE returns #DIV/0!. Text, blanks and logical values in either range are dropped in pairs. A slope describes a straight-line fit only; check a chart before using it on curved data.
C2:C6. This comes first.B2:B6. It must hold the same number of values as known_ys.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
B8 =SLOPE(C2:C6,B2:B6)
Result: 2.8
Sales is y and ad spend is x. Each extra unit of ad spend goes with 2.8 more units of sales on the best-fit line.
B8 =SLOPE(C2:C6,B2:B6) returns 2.8
Example 2
B8 =ROUND(SLOPE(B2:B6,C2:C6),3)
Result: 0.354
With the arguments swapped, the slope is ad spend per unit of sales. It is not the reciprocal of 2.8, because the fit is not perfect.
B8 =ROUND(SLOPE(B2:B6,C2:C6),3) returns 0.354
Example 3
B8 =SLOPE(C2:C6,B2:B6)
Result: -10
Each 1 increase in price goes with 10 fewer units sold.
B8 =SLOPE(C2:C6,B2:B6) returns -10
Example 4
B9 =ROUND(SLOPE(B2:B7,A2:A7),2)
Result: 8.57
Using the month number as x, the trend line adds about 8.57 to sales each month.
B9 =ROUND(SLOPE(B2:B7,A2:A7),2) returns 8.57
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B8, return how much the delivery cost rises, on the best-fit line, for each extra kilometre.
Answer in B8.
SLOPE(known_ys, known_xs). Swapping them returns a different number with no error.#N/A.#DIV/0!.The y values, the ones you want to explain. `=SLOPE(sales, ad_spend)` gives the change in sales per unit of ad spend. Swapping them gives the reverse relationship.
y falls as x rises. For example, units sold fall as the price increases.
Use a period number or a date as x. `=SLOPE(B2:B13,A2:A13)` with dates in column A gives the average change per day. Multiply by 30 for a rough monthly figure.
It is the same number as the slope of a linear trendline. Use INTERCEPT for where that line crosses the y axis.
Tracks take you from the basics to modelling, one graded exercise at a time.