# 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.

Toggle

### Syntax

The SLOPE function syntax is:

SLOPE(known_y’s, known_x’s)

• known_y’s: The set of dependent variables.
• known_x’s: The set of independent variables.

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.

### Example

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.

• A (Advertising Costs): \$100, \$200, \$300, \$400
• B (Sales Revenue): \$500, \$700, \$900, \$1100

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).

### Tips

• The SLOPE function is often used along with the INTERCEPT function to find the equation of the linear regression line, which is in the form Y = mX + b, where m is the slope and b is the intercept.
• Ensure your data is accurate and properly sorted if required. Outliers or incorrect data points can significantly affect the slope calculation.