Category: FUNCTION | Updated: 2026-11-22
How to Use the SLOPE Function in Google Sheets | Calculate the Slope of a Linear Regression Line
Syntax
=SLOPE(data_y, data_x)
- data_y: The cell range of dependent data (Y-axis values).
- data_x: The cell range of independent data (X-axis values).
Example with a Table
Here is an example of calculating how many points a test score increases per hour of study (the slope) from study hours (A2:A6) and test scores (B2:B6).
| Cell | A (Study Hours) | B (Test Score) | C (Metric) | D (Formula) | E (Result) |
|---|---|---|---|---|---|
| 1 | Study Hours | Score | Metric | Formula | Result |
| 2 | 2 | 55 | Regression Line Slope | =SLOPE(B2:B6, A2:A6) |
6.5 |
| 3 | 4 | 68 | |||
| 4 | 6 | 80 | |||
| 5 | 8 | 94 | |||
| 6 | 10 | 107 |
The slope is calculated as 6.5, showing a trend where test scores increase by an average of 6.5 points for each additional hour of study.
Common Errors and Notes
- Watch the order of Y and X: Specify arguments in the order
SLOPE(data_y, data_x). Reversing them calculates a different slope with X and Y swapped. #N/AError: Occurs ifdata_yanddata_xdo not have the same number of cells.#DIV/0!Error: Occurs if there are fewer than 2 valid numeric pairs, or if all values indata_xare identical with no variation.
Frequently Asked Questions
Q. What does the "slope" calculated by SLOPE represent?
A. It is the "m" value in the regression line (y = mx + b). For example, if X is ad spend ($10k) and Y is sales ($10k), SLOPE represents the efficiency: how much sales increase on average for each 1-unit increase in ad spend.
Q. When does the SLOPE function return a negative value?
A. The slope is negative when Y decreases as X increases (a negative correlation)—for example, when raising a product's price reduces the number of units sold.