Excel Slope Function

Slope Equation

The Excel Slope Function uses the following equation to calculate the slope of the linear regression line through a set of given points:

Equation for the slope of a linear regression line
where the values of   x   and   y   are the sample means (the averages) of the known x's and the known y's.
Related Function:
INTERCEPT function

Function Description

The Excel Slope function calculates the slope of the linear regression line through a supplied set of x- and y- values.

The syntax of the function is:

SLOPE( known_y's, known_x's )

Where the arguments are as follows:

known_y's - An array known y-values.
known_x's -

An array of known x-values.

Note that the length of the known_x's array should be the same length as known_y's, and the variance of the known_x's must not be zero.


Slope Function Example

The spreadsheet below shows an example of the Excel Slope function used to calculate the slope of the linear regression line through the known_x's and known_y's, in cells F2:F7 and G2:G7.

Example of use of the Excel Slope Function

As shown in cell F9, the Slope function used is:

=SLOPE( G2:G7, F2:F7 )

which gives the result 4.628571429.


For further examples of the Excel Slope function, see the Microsoft Office website


Slope Function Errors

If you get an error from the Excel Slope function, this is likely to be one of the following:

Common Errors
#N/A - Occurs if the supplied known_x's and known_y's arrays are of different lengths.
#DIV/0! -

Occurs if either:

  • The variance of the supplied known_x's evaluates to zero
or
  • Either of the supplied known_x's or known_y's arrays is empty.