In this Article

*This Excel Tutorial demonstrates how to use the Excel SLOPE Function in Excel to calculate the slope.*

## SLOPE Function Overview

The SLOPE Function Calculates the slope of a line generated by linear regression.

To use the SLOPE Excel Worksheet Function, select a cell and type:

(Notice how the formula inputs appear)

## SLOPE Function Syntax and inputs:

1 |
=SLOPE(known_ys,known_xs) |

**known_y’s** – An array of known Y values.

**known_x’s** – An array of known X values.

## What is SLOPE?

The SLOPE function in Excel is used to calculate the slope of a line given known *x* and *y* values.

The SLOPE function can be used in conjunction with the INTERCEPT function to find the equation of a linear line,

1 |
y = a + bx |

Suppose I have a table of data with x and y values:

The slope of a line is calculated by plotting the data and using the

method, demonstrated below:

Using the above chart, we can calculate the slope, *b* using the rise of the line divided by the run of the line.

Using the SLOPE function:

## How to use SLOPE

The SLOPE function takes two arguments:

1 |
=SLOPE(known_y’s, known_x’s) |

Where *known_y’s* and *known_x’s* refer to the *x* and *y* data in your data table.

Using our first example, the function is written as:

1 |
=SLOPE(B3:B7,C3:C7) |

## Pairing SLOPE and INTERCEPT

To pair SLOPE and INTERCEPT, an equation can be written as:

1 |
= INTERCEPT(B3:B7,C3:C7) + SLOPE(B3:B7,C3:C7) * x |

## Interested in More Forecasting?

Pair SLOPE with INTERCEPT to see how to create the equation of a line and visit our other articles on Forecasting with Exponential Smoothing, TREND and LINEST functions.

## SLOPE function in Google Sheets

The SLOPE function works exactly the same in Google Sheets as in Excel.

## Additional Notes

The slop of the regression line is calculated as <<<<<<<<<<<>>>>>>>>>>>>>>

Known_y’s and Known_x’s must not be empty and must have the same number of data points.

## SLOPE Examples in VBA

You can also use the SLOPE function in VBA. Type:

`application.worksheetfunction.slope(known_ys,known_xs)`

For the function arguments (known_y’s, etc.), you can either enter them directly into the function, or define variables to use instead.

Return to the List of all Functions in Excel