SLOPE
Returns the slope of the linear regression line for paired data.
SLOPE fits y = m*x + b and returns m, the rate of change in y per unit of x.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=SLOPE(known_ys, known_xs)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
known_ys | number (range) | Required | — |
known_xs | number (range) | Required | — |
Remarks
known_yandknown_xmust have the same numeric length.
Error cases
- Returns
#N/Afor mismatched lengths. - Returns
#DIV/0!if allxvalues are identical.
Examples
Describe a linear fit between paired x and y observations.
Formula =SLOPE({2,5,6,9},{1,2,3,4})
Expected result 2.2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Reverse the order of the y series while leaving x unchanged.
Formula =SLOPE({9,6,5,2},{1,2,3,4})
Expected result -2.2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Evaluate a series whose observations lie exactly on a line.
Formula =SLOPE({2,4,6},{1,2,3})
Expected result 2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The known x and y series must contain corresponding observations.
Formula =SLOPE({2,5,6,9},{1,2,3})
Expected result #N/A
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Negative slope from ranges
Formula =SLOPE(A1:A3,B1:B3)
| A | B | |
|---|---|---|
| 1 | 10 | 1 |
| 2 | 8 | 2 |
| 3 | 6 | 3 |
Expected result -2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.