**SLOPE Function in Excel (Table of Contents)**

## SLOPE Function in Excel

SLOPE Function is a statistical function in excel. SLOPE Function calculates the slope of a line generated by linear regression. In Excel, Slope is calculated by considering the datum points on a straight line called as Known Xs and Known Ys. In a straight line equation which is formed by using Slope and Intercept where Slope is ratio of rise and run which are there anywhere in the straight line. For example we have created a straight line using some values and we need to find the Slope of that using few or all the used values, this is done using Slope function.

Before going to a brief introduction on the SLOPE Function in excel let us discuss what is SLOPE?

### What is SLOPE of a Line?

The slope of a line nothing but the Steepness of the line. The slope of a straight line shows how steep the line is. “The steeper the line the larger the slope”.

Now, look at the below lines.

Let me say each of the above lines represents the money in the bank account over a period.

**Line 1: **This line is going up. That means the amount of money in this bank account increasing over a period.

**Line 2: **This line is going down. That means the amount of money in this bank account decreasing over a period.

4.8 (6,326 ratings)

View Course

**Line 3: **This is horizontal straight line neither goes up nor comes down. This is a steady line and the amount of money remains constant.

** Line 4: **This is a line is also going up like the first line. But this line seems going up faster than the first line. This line looks steeper than the first one. The amount of money in this bank account is increasing faster because of the steeper line.

What if we want to be specific about how we describe this steepness. SLOPE is described as the steepness of the line.

**SLOPE = RISE / RUN**

RISE is the vertical change & RUN is the horizontal change.

To fund the SLOPE we take the “change in rise over a change in run”.

**Examples of SLOPE:**

**Example 1:** Look at the below graph.

Slope of the line = 4/4 = 1

**Example 2:** Look at the below graph.

Slope of the line = 6/2 = 3

**Example 3:** Look at the below graph.

Slope of the line = 3/6 = 0.5

**Example 4:** Look at the below graph.

Slope of the line = -4/2 = -2

**SLOPE Formula in Excel:**

Below is the SLOPE Formula in Excel :

SLOPE Formula includes two arguments:

**Known_y’s:**This is a range of cells of numeric dependent values.**Known_x’s:**This is a range of cells of numeric independent values.

The length of the Known_y’s should be same as the length of the Known_x’s but the variance should not be zero.

### How to Use the SLOPE Function in Excel?

SLOPE Function in Excel is a very simple and easy to use. Let us now see how to use this SLOPE Function in Excel with the help of some examples.

#### Example #1

In this example, I have two set of values (Known_y’s and Known_x’s). Calculate the slope of these two ranges using SLOPE Function in excel.

Apply SLOPE Function to get the slope value of the line.

So the Result will be :

Insert graph for it.

**Example 2:** We can directly enter the values to the formula itself but with curly brackets. Below images are the examples for it.

**Picture 1**

So the Result will be :

**Picture 2**

So the Result will be :

### SLOPE as VBA Function

Below is the code for running macro for SLOPE Function :

**Sub SLOPE_Example()**

**Step 1:** Declare variables

Dim Known_X As Range

Dim Known_Y As Range

**Step 2:** Set the object variables

Set Known_X = Range(“A2:A7”)

Set Known_Y = Range(“B2:B7”)

**Step 3:** Show the result in Message Box

MsgBox Application.WorksheetFunction.Slope (Known_Y, Known_X)

**End Sub**

### Things to Remember

- Both the parameters are should be in the same length. For example, if Known_y’s range is A2: A10 then Known_x’s values should be in the range of the same length.
- Both the arguments can accept only numerical values, if there are text or string values then it excludes those values. The arguments can contain numbers or names that contain numbers.
- Both the arguments should not be empty if any one of the ranges is empty then the result will be #DIV/0!
- A variance of the two arguments should not be zero. If the vaeducba.com/sum-function-in-excelriance is zero then we will get #DIV/0!
- Learn the basics of SLOPE to understand the working method of SLOPE in excel.

This has been a guide to SLOPE Function in Excel. Here we discuss the SLOPE Formula in Excel and how to use SLOPE Function in Excel along with practical examples and downloadable excel templates. You can also go through our other suggested articles –