SLOPE Function Examples in Excel, VBA, & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on November 9, 2023
Download Example Workbook

Download the example workbook

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

SLOPE Main Function

What is the SLOPE Function?

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,

y = a + bx

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

SLOPE Function EX01

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

SLOPE Formula EX01

method, demonstrated below:

SLOPE Function EX02

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

SLOPE Formula EX02

Using the SLOPE function:

SLOPE Function EX03

How to use SLOPE

The SLOPE function takes two arguments:

=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:

=SLOPE(B3:B7,C3:C7)

Pairing SLOPE and INTERCEPT

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

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

SLOPE function in Google Sheets

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

SLOPE Google Function

SLOPE Examples in VBA

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

application.worksheetfunction.slope(known_ys,known_xs)

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to List of Excel Functions