How to Get the Slope of a Graph in Excel

Cody Schneider8 min read

Finding the slope of a line on a graph is one of the most practical ways to understand the relationship between two sets of data. It tells you exactly how much one variable changes for every single unit of change in another. This article will show you three straightforward methods to calculate the slope of a graph directly within Excel.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What Exactly Is 'Slope' and Why Does It Matter?

Before jumping into the how-to, let's quickly clarify what we mean by slope. In simple terms, slope is the "rise over run" of a line. It measures its steepness. In a business context, this is incredibly useful for spotting trends.

  • "Rise" is the vertical change between two points (your Y-axis value, like Sales Revenue).
  • "Run" is the horizontal change between those same two points (your X-axis value, like Months or Ad Spend).

Imagine you're plotting your store's sales revenue each month. The months are your X-axis values (the "run"), and the sales revenue is your Y-axis values (the "rise").

  • A positive slope means the line goes up from left to right. This is a positive trend - for example, your sales are increasing over time.
  • A negative slope means the line goes down from left to right. This is a negative trend - for instance, customer churn is increasing each quarter.
  • A slope of zero means the line is flat. There's no upward or downward trend in your data.

Calculating the slope gives you a single, powerful number that summarizes the trend. A slope of 500 would mean that, on average, your sales increased by $500 each month. A slope of -20 might mean you lost an average of 20 subscribers each week.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 1: Get the Slope Using an Excel Chart Trendline

This is the most visual and often the most intuitive way to find the slope. You create a chart, add a trendline, and have Excel display the formula for that line, which includes the slope.

Let's use an example. Say we have monthly website traffic data for the past year and we want to find the average monthly growth trend.

Step 1: Set Up Your Data Organize your data into two columns. The left column should be your independent variable (the X-axis), and the right should be your dependent variable (the Y-axis). In this case, 'Month' is our X-axis and 'Traffic (Sessions)' is our Y-axis.

Step 2: Create a Scatter Plot A scatter plot is the perfect chart for this because it shows the relationship between two sets of numeric data.

  • Highlight your entire data set, including the headers.
  • Go to the Insert tab on the Ribbon.
  • In the Charts section, click the Scatter (X, Y) chart icon.
  • Select the first scatter plot option without any lines connecting the dots.

Step 3: Add a Trendline Now we'll add the line of best fit that represents the general trend of our data points.

  • Click on your newly created chart to select it.
  • Click the + icon (Chart Elements) on the top right corner of the chart.
  • Hover over Trendline and click the small arrow that appears.
  • Select More Options... This will open the 'Format Trendline' pane on the right side of your screen.

Alternatively, you can just right-click on any of the blue data points within the chart and select "Add Trendline..." from the menu.

Step 4: Display the Equation on the Chart Here's where we get our slope value. In the 'Format Trendline' pane, scroll down and check the box that says "Display Equation on Chart."

Excel will add a text box to your chart with an equation in the format y = mx + b.

  • m is the slope.
  • x is your independent variable.
  • b is the y-intercept (the value of y when x is 0).

In our example, the equation is y = 1113.8x + 29339. The number right before the 'x' is our slope. So, the slope is 1113.8. This number tells us that, on average, website traffic grew by about 1,114 sessions each month.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 2: Directly Calculate the Slope with the SLOPE Function

If you don't need a chart and just want the slope value in a cell for another calculation, using Excel's SLOPE function is much faster.

Step 1: Understand the SLOPE Function Syntax The formula is simple: =SLOPE(known_y's, known_x's)

  • known_y's: This is your range of dependent data (e.g., your 'Traffic' column).
  • known_x's: This is your range of independent data (e.g., your 'Month' column).

Step 2: Enter the Formula Using the same data as before:

  • Click on any empty cell where you want the slope to appear.
  • Type =SLOPE(
  • Select the range for your known_y's. For our data, that's C2:C13.
  • Type a comma ,.
  • Select the range for your known_x's. For our data, that's B2:B13.
  • Close the parenthesis ) and press Enter.

The full formula will be: =SLOPE(C2:C13, B2:B13)

Instantly, Excel calculates and displays the slope in that cell: 1113.846. This is the exact same number we found using the chart method but obtained much more quickly.

Method 3: Use the LINEST Function for More Statistical Detail

For those who need more than just the slope, the LINEST (Linear Estimate) function is the most powerful option. It's an array formula that returns not only the slope and y-intercept but also other regression statistics like r² (r-squared) and standard error.

This method is a bit more advanced but is perfect for deeper analysis.

Step 1: Understand the LINEST Function Syntax The basic structure is similar to SLOPE, but with two optional arguments: =LINEST(known_y's, [known_x's], [const], [stats])

  • [const]: A logical value. If TRUE (or omitted), Excel calculates the normal y-intercept. If FALSE, the intercept is forced to be 0.
  • [stats]: A logical value. If TRUE, the function returns additional regression statistics. If FALSE or omitted, it only returns the slope and intercept. We'll set this to TRUE.

Step 2: Select the Output Range Because LINEST returns multiple values (an array), you need to select a block of cells before entering the formula. To get all the primary statistics, select an empty range that is two columns wide and five rows high.

Step 3: Enter the Formula as an Array Formula With your 2x5 cell range still selected:

  • Type the following formula into the formula bar: =LINEST(C2:C13, B2:B13, TRUE, TRUE)
  • Instead of just pressing Enter, press Ctrl + Shift + Enter (for Windows) or Cmd + Shift + Enter (for Mac). This tells Excel to enter it as an array formula, filling all the cells you selected.

Note: If you have a newer version of Excel with dynamic arrays, you may only need to press Enter, and Excel will automatically "spill" the results into the adjacent cells.

Step 4: Interpret the Results Excel will populate the 2x5 grid of cells with statistical information. Here’s what it means:

  • Top-Left Cell: The slope (1113.846). This is the number we're looking for.
  • Top-Right Cell: The y-intercept (29339.3).
  • Second Row: Standard error values for the slope and intercept.
  • Third Row, Left: The r² value, which tells you how well the line fits your data (a value closer to 1 is a better fit).
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Which Method is Best for You?

  • Use the Chart Method (Trendline) when you want to create a visual presentation of your trend and show the relationship graphically. It's perfect for reports and dashboards.
  • Use the SLOPE Function when you just need the slope value quickly for use in another formula or as a standalone metric. It's the most efficient for pure calculation.
  • Use the LINEST Function when you need to perform more detailed statistical analysis and require metrics beyond just the slope, such as the goodness of fit (r²) or standard error.

Final Thoughts

Calculating the slope in Excel, whether visually with charts or numerically with formulas, is a fantastic skill for transforming raw data into a clear trend analysis. Each method - the chart trendline, the SLOPE function, and the LINEST function - offers a different level of detail to suit your needs, making it easier than ever to understand the story your data is telling.

While mastering these functions is great, this type of manual analysis is often the start of a repetitive cycle. Pulling data from various platforms, cleaning it, building charts, and then repeating it all next week can consume hours. We built Graphed because we believe your time is better spent acting on insights, not manually gathering them. By connecting your sources like Google Analytics, Shopify, or HubSpot just once, you can ask for the analysis you need in simple language - like "compare sales vs ad spend for campaigns this quarter" - and get a live, interactive dashboard that updates automatically, without ever opening a spreadsheet again.

Related Articles