How to Find the Slope of a Regression Line in Excel (3 Easy Ways)

What Is the Slope of a Regression Line?

A regression line generally shows the connection between some scatter data points from a dataset. The equation for a regression line is:

y = mx + b

  • m = Slope of the Regression Line.
  • B = Y-Intercept.

You can also use the following formula to find the slope of a regression line:

m = ∑(x-µx)*(y-µy)/∑(x-µx

  • µx= Mean of known x values.
  • µy= Mean of known y values.

How to Find the Slope of a Regression Line in Excel: 3 Easy Ways

We have the following dataset, containing the Month, Advertisement Cost, and Sales.

Dataset to Find the Slope of a Regression Line in Excel


Method 1 – Use an Excel Chart to Find the Slope of a Regression Line


Step 1 – Insert a Scatter Chart

  • Select the data range with which you want to make the chart.
  • Go to the Insert tab from the Ribbon.
  • Select Insert Scatter or Bubble Chart.

Use Excel Chart to Find the Slope of a Regression Line

  • A drop-down menu will appear.
  • Select Scatter.

Insert Scatter Chart in Excel to Find Slope of a Regression Line

  • This inserts a Scatter Chart for your selected data.
  • Change the Chart Title.

  • We have changed the Chart Title.


Step 2 – Add a Trendline

  • Select the chart.
  • Select Chart Elements.
  • Check the Trendline option.

Add Trendline to Excel Chart to Find Slope of a Regression Line

  • Here’s the trendline.


Step 3 – Display the Trendline Equation on the Chart and Find the Slope

  • Right-click on the Trendline.
  • Select Format Trendline.

Display Trendline Equation on Chart and Find Slope of a Regression Line in Excel

  • The Format Trendline task pane will appear on the right side of the screen.
  • Select the Trendline Options tab.
  • Check the Display Equation on chart option.

  • You will be able to see the equation for the Trendline on the chart.

  • Determine the Slope from the equation (the part before the x) and write it down in your preferred location.

Read More: How to Find Instantaneous Slope on Excel


Method 2 – Apply the SLOPE Function to Calculate the Slope of a Regression Line in Excel

Steps:

  • Select the cell where you want the Slope. We selected Cell C12.
  • Insert the following formula.

=SLOPE(D5:D10,C5:C10)

Apply SLOPE Function to Calculate the Slope of a Regression Line in Excel

  • Press Enter to get the result.

In the SLOPE function, we selected cell range D5:D10 as known_ys, and C5:C10 as known_xs. The formula will return the slope of the regression line for these data points.

Read More: How to Find the Slope of a Line in Excel


Method 3 – Determine the Slope of a Regression Line Manually Using SUM and AVERAGE Functions

Steps:

  • Select the cell where you want the Slope.
  • Insert the following formula in the selected cell:

=SUM((C5:C10-AVERAGE(C5:C10))*(D5:D10-AVERAGE(D5:D10)))/SUM((C5:C10-AVERAGE(C5:C10))^2)

Determine Slope of a Regression Line Manually Using SUM and Average Functions

  • Press Enter to get the result.

How Does the Formula Work?

  • AVERAGE(C5:C10): The AVERAGE function returns the average of cell range C5:C10.
  • (C5:C10-AVERAGE(C5:C10)): The average is subtracted from the cell range C5:C10.
  • AVERAGE(D5:D10): The AVERAGE function returns the average of cell range D5:D10.
  • (D5:D10-AVERAGE(D5:D10): The average is subtracted from the cell range D5:D10.
  • (C5:C10-AVERAGE(C5:C10))*(D5:D10-AVERAGE(D5:D10)): The formula multiplies the results it got from the previous formulas.
  • SUM((C5:C10-AVERAGE(C5:C10))*(D5:D10-AVERAGE(D5:D10))): The SUM function returns the summation of these values.
  • (C5:C10-AVERAGE(C5:C10))^2: The average of cell range C5:C10 is subtracted from cell range C5:C10. And then raised to the power of 2.
  • SUM((C5:C10-AVERAGE(C5:C10))^2): The SUM function returns the summation of the values it got from the previous calculation.
  • SUM((C5:C10-AVERAGE(C5:C10))*(D5:D10-AVERAGE(D5:D10)))/SUM((C5:C10-AVERAGE(C5:C10))^2): The first summation is divided by the second summation.

Read More: How to Find Slope of Logarithmic Graph in Excel


Practice Section

We have provided a practice sheet for you to practice how to find the slope of a regression line in Excel.

Practice Sheet for How to Find the Slope of a Regression Line


Download the Practice Workbook


Related Articles


<< Go Back to Excel SLOPE Function | Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mashhura Jahan
Mashhura Jahan

Mashhura Jahan, BSc in Industrial and Production Engineering from Bangladesh University of Engineering and Technology, invested 1.5 years at ExcelDemy. In roles like Excel & VBA Content Developer, Excel Charts, and Dashboard course trainer, she wrote 90+ articles. She was previously part of the forum support team and a junior software analyst on the Excel Add-in project. With interests spanning Excel, VBA, Power Query, Python, Data Science, and Software Development, Mashhura brings a diverse skill set to her... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo