Site icon Best Excel Tutorial

How to use SLOPE function

The SLOPE function in Excel is a statistical function that calculates the slope of a line through a set of data points. The slope is the rate of change between the dependent variable (y-axis) and the independent variable (x-axis). It’s used to determine the linear relationship between two data sets, which is useful in forecasting and linear regression analysis.


The SLOPE function syntax is:

SLOPE(known_y’s, known_x’s)

Both arguments must be arrays or ranges with the same number of data points; otherwise, Excel returns an error.

Steps to Use the SLOPE Function

  1. Arrange your data in two columns. One column should represent the independent variable (X), and the other should represent the dependent variable (Y).
  2. Click on the cell where you want the slope result to appear.
  3. Type =SLOPE( into the selected cell.
  4. Click and drag to select the range for the dependent variable (Y) data, type a comma, then click and drag to select the range for the independent variable (X) data.
  5. After selecting the ranges, close the parenthesis and press Enter. Excel will calculate the slope of the line that best fits your data based on the least squares method.


Suppose you have data for advertising costs (independent variable) in column A and sales revenue (dependent variable) in column B. You want to find the slope of the line that best fits this data to understand how sales revenue changes with advertising costs.

Select a cell where you want the SLOPE result, and enter the SLOPE function as follows:

=SLOPE(B1:B4, A1:A4)

This formula uses B1:B4 as the known_y’s (sales revenue) and A1:A4 as the known_x’s (advertising costs).

After pressing Enter, Excel calculates the slope. In this example, the slope would indicate how much sales revenue (Y) is expected to increase for each unit increase in advertising costs (X).


Exit mobile version