How to Calculate Correlation Coefficient in Excel Graph

Cody Schneider8 min read

Displaying the correlation coefficient directly on your Excel graph transforms a simple chart into a powerful data narrative. It gives your audience an immediate, quantitative measure of the relationship between your variables, right alongside the visual trend. This article will show you exactly how to calculate the correlation coefficient and add it to your Excel charts for more insightful reports.

What Exactly is a Correlation Coefficient?

Before we jump into Excel, let's quickly clarify what this metric means. The correlation coefficient, often represented as r, is a number between -1 and 1 that measures the strength and direction of a linear relationship between two variables. That's it. It’s a single number that tells you how well two sets of data move in relation to each other.

  • A Positive Correlation (approaching +1): This means as one variable increases, the other variable tends to increase as well. For example, the more hours you spend studying for an exam (variable A), the higher your exam score is likely to be (variable B). A perfect positive correlation of +1 means they move in perfect sync.
  • A Negative Correlation (approaching -1): This is the opposite. As one variable increases, the other tends to decrease. Think about the number of hours you stream TV shows (variable A) and the amount of free time you have left (variable B). As TV time goes up, free time goes down. A perfect negative correlation is -1.
  • No Correlation (around 0): This indicates there is no linear relationship between the variables. For example, there's likely no meaningful correlation between the price of coffee in Brazil and the number of goals your local soccer team scores. They are unrelated.

Understanding this simple concept is key to interpreting the numbers you're about to calculate and display in Excel.

Step 1: Get Your Data Ready

First things first, your data needs to be organized properly. For calculating correlation, you need two sets of numerical data corresponding to your two variables. The best practice is to place them in two adjacent columns.

Let's use a common marketing example. We want to see if there's a correlation between our monthly advertising spend and the number of website visitors we get. Our data in Excel might look like this:

Example Data:

Column B (Ad Spend) and Column C (Website Visitors) are the two variables we'll be analyzing. Ensure your data is clean, numerical, and ready to go.

Step 2: Calculate the Correlation Coefficient (r)

Before we add the value to a graph, we need to calculate it. Excel gives you two simple ways to do this: using the CORREL function or the Data Analysis ToolPak.

Using the CORREL Function

This is the quickest and most direct method. The CORREL function simply asks for your two data ranges and returns the correlation coefficient.

  1. Find an empty cell where you want to display your result (e.g., cell E2).
  2. Click on the cell and type the formula: =CORREL(Array1, Array2)
  3. For Array1, select your first data range. In our example, that would be cells B2:B7 (Ad Spend).
  4. For Array2, select your second data range. That would be cells C2:C7 (Website Visitors).
  5. Your final formula will look like this: =CORREL(B2:B7, C2:C7)
  6. Press Enter. Excel will instantly calculate the correlation coefficient. For our sample data, the result is approximately 0.99, indicating a very strong positive correlation. We'll use this calculated value later for our chart.

Using the Data Analysis ToolPak

If you want a more comprehensive statistical summary, the Data Analysis ToolPak is a great option. It might seem more complex, but it's very powerful if you need to analyze multiple variables at once.

First, ensure the ToolPak is enabled:

  • Go to File > Options > Add-ins.
  • At the bottom, make sure "Excel Add-ins" is selected in the Manage dropdown and click Go...
  • Check the box for "Analysis ToolPak" and click OK. The Data Analysis button will now appear on your Data tab.

Now, run the correlation analysis:

  1. Go to the Data tab and click Data Analysis.
  2. Select Correlation from the list and click OK.
  3. In the Input Range box, select all your data, including the headers (e.g., B1:C7).
  4. Check the box for "Labels in First Row".
  5. Choose an Output Range by selecting a single cell where you want the results to start.
  6. Click OK.

Excel will produce a small correlation matrix. The value where "Ad Spend" and "Website Visitors" intersect is your correlation coefficient, the same 0.99 from the CORREL function.

Step 3: Create a Scatter Plot to Visualize the Relationship

A scatter plot is the perfect chart for visualizing correlation. Each point on the graph represents one row of your data (e.g., one month's ad spend and its corresponding visitor count), making it easy to see the trend.

  1. Select your two columns of numerical data (columns B and C).
  2. Go to the Insert tab in the Excel ribbon.
  3. In the Charts group, click the icon for Insert Scatter (X, Y) or Bubble Chart.
  4. Choose the first option, the basic Scatter plot.

Excel will immediately generate a scatter plot on your worksheet. You can already see the points trending upwards and to the right, which visually confirms our strong positive correlation.

Step 4: Add the Correlation Value to Your Graph

Here's where we tie it all together. There are two primary ways to display a correlation-related value on your graph: showing the R-squared value (the easy, built-in method) or showing the actual correlation coefficient (the better, more direct method).

Method 1: Displaying the R-squared Value (R²)

Excel doesn't have a one-click button to add the correlation coefficient (r), but it has one for the R-squared value. R-squared is simply the correlation coefficient squared (r * r). It tells you the proportion of variance in the dependent variable that can be predicted from the independent variable. It’s still useful, and here's how to show it:

  1. Click on your scatter plot to activate it. A (+) icon should appear in the top-right corner.
  2. Click the (+) icon to open the Chart Elements menu.
  3. Check the box next to Trendline. A line will appear on your chart showing the general trend.
  4. Hover over Trendline again and click the small arrow that appears to the right. Select More Options...
  5. In the Format Trendline pane that opens, scroll to the bottom and check the box labeled "Display R-squared value on chart".

An equation and the R² value (e.g., R² = 0.9859) will now appear on your chart. This indicates that about 98.6% of the variation in website visitors can be explained by ad spend. To find the correlation coefficient r, take the square root of R². In a spare cell, type =SQRT() and click the cell with R²—including the sign of the slope to determine if the correlation is positive or negative.

Method 2: Displaying the Actual Correlation Coefficient (A Better Way)

For more clarity, it’s better to display the actual r value we calculated earlier. We can do this by linking a text box dynamically to our CORREL formula result.

  1. Ensure you have the correlation coefficient calculated in a cell (e.g., E2).
  2. Select your chart. Go to the Insert tab, click Text > Text Box.
  3. Draw a text box anywhere on your chart.
  4. Do NOT type anything in the text box. Instead, click on its border, then click inside the Formula Bar at the top of Excel.
  5. Type = and then click the cell with your correlation coefficient (E2).
  6. Press Enter. The number from E2 will appear in your text box. If your data updates, the value will update automatically.
  7. To format it, go back to cell E2 and change the formula to: "Correlation (r): " & TEXT(CORREL(B2:B7, C2:C7),"0.00") This displays the label and the rounded r value dynamically.

Putting It All in Context: A Word of Caution

Calculating and visualizing correlation is a fantastic skill, but it comes with a critical warning: correlation does not imply causation. Just because two variables move together doesn't mean one is causing the other.

The classic example is ice cream sales and shark attacks. If you plot them, you'll find a strong positive correlation. Does buying an ice cream cause sharks to attack? Of course not. The "lurking variable" is summer weather. Hotter temperatures cause more people to buy ice cream and more people to go swimming, leading to an increase in both metrics independently.

Always examine your scatter plot visually. Watch for outliers—single data points far from the rest—that can disproportionately skew your r value. And remember, the correlation coefficient only measures a linear relationship. Your data might have a clear pattern (like a curve) but a low correlation coefficient if that pattern isn't a straight line.

Final Thoughts

Adding the correlation coefficient to your Excel graph provides an immediate, powerful layer of context. It connects the visual pattern of your scatter plot to a definitive number, making your report clearer and more convincing for your entire team. Now you can easily demonstrate the strength of a relationship, not just show it.

Of course, this process can become time-consuming when you're pulling data from different places—Google Ads, Shopify, Salesforce, etc.—just to get it into a spreadsheet. When we built Graphed, we focused on eliminating that manual work. You can simply connect your data sources once and use plain language to ask questions like, "Show me the correlation between my Google Ads spend and Shopify sales last month." Graphed instantly builds the visual dashboard, saving you the steps of exporting CSVs and running calculations in Excel.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.