Correlation Coefficient in Excel: Step-by-Step Guide
In this article
To work out the correlation coefficient in Excel, use the =CORREL(array1, array2) function. This formula calculates the Pearson Correlation Coefficient, which tells you the strength and direction of a linear relationship between two sets of numbers. The result will always be a value between -1 and 1, where 1 is a perfect positive correlation, -1 is a perfect negative correlation, and 0 indicates no linear relationship.
What You'll Need
- Microsoft Excel (any modern version, including Office 365, Excel 2021, or Excel Online).
- Two sets of numerical data of equal length (e.g., a column for "Advertising Spend" and a column for "Total Sales").
- Data organized in columns or rows so that corresponding values are aligned.
Step-by-Step
- Prepare your data: Enter your first set of data into one column (e.g., Column A) and your second set of data into the adjacent column (e.g., Column B). Ensure that the data points are paired correctly; for example, the value in cell A2 must relate directly to the value in cell B2.
- Select an output cell: Click on an empty cell where you want the correlation coefficient result to appear.
- Enter the CORREL formula: Type
=CORREL(into the cell. - Select the first data range: While the formula is open, click and drag your mouse to highlight all the numerical values in your first column (e.g., A2:A50). Alternatively, you can type the range manually.
- Add a comma: Type a comma
,to separate the two arguments in the function. - Select the second data range: Click and drag to highlight all the numerical values in your second column (e.g., B2:B50).
- Close and execute: Type a closing parenthesis
)and press Enter.
Common Mistakes
- Unequal Range Sizes: One of the most common errors is selecting ranges of different lengths (e.g., selecting A2:A50 but B2:B49). Excel will return a #N/A error if the arrays are not the same size.
- Including Text Labels: If you include the column headers (the text at the top) in your range selection, Excel generally ignores them, but it is best practice to select only the numerical cells to avoid calculation errors.
- Confusing Correlation with Causation: A high correlation coefficient (e.g., 0.9) proves that two variables move together, but it does not prove that one variable causes the other to change.
- Non-Linear Data: The CORREL function only measures linear relationships. If your data follows a curve (exponential or logarithmic), the correlation coefficient may be close to 0 even if there is a very strong non-linear relationship.
Tips
- Use Absolute References: If you plan to drag the formula to calculate correlations across multiple columns, use dollar signs to lock your ranges (e.g.,
=CORREL($A$2:$A$50, B2:B50)). - Visualize with a Scatter Plot: Before calculating the coefficient, highlight your data and go to Insert > Scatter Chart. This allows you to see the trend visually and confirm if a linear correlation is the right tool for your data.
- Check for Outliers: A single extreme value (an outlier) can significantly skew your correlation coefficient, making a relationship seem stronger or weaker than it actually is.
- Use the Data Analysis Toolpak: If you have many variables and need a "Correlation Matrix" (a table showing correlations between all possible pairs of columns), enable the Analysis ToolPak via File > Options > Add-ins and use the Correlation tool under the Data Analysis menu.
Troubleshooting
If your formula is not working as expected, try these steps in order:
- Check for #N/A: This usually means your two selected ranges are different sizes. Double-check that both ranges start and end on the same row numbers.
- Check for #DIV/0!: This error occurs if one of your data sets has zero variance (i.e., every single number in the column is exactly the same). Correlation cannot be calculated if there is no variation in the data.
- Check for #VALUE!: This happens if the selected range contains cells that Excel cannot recognize as numbers (such as text disguised as numbers or hidden characters). Ensure all cells in the range are formatted as "Number" or "General."
- Verify Data Alignment: If the result seems impossibly low or high, ensure your data isn't sorted independently. If you sorted Column A but not Column B, the paired relationship is broken, and the result will be meaningless.
Frequently Asked Questions
What does a correlation of 0.7 mean?
A result of 0.7 indicates a strong positive linear relationship. This means as the value of one variable increases, the value of the other variable tends to increase as well.
What is the difference between CORREL and PEARSON functions?
In modern versions of Excel, =CORREL and =PEARSON perform the exact same calculation. CORREL is more commonly used and is the standard recommendation.
Can the correlation coefficient be higher than 1 or lower than -1?
No. Mathematically, the Pearson correlation coefficient is always constrained between -1.0 and 1.0. If you see a number outside this range, there is an error in the formula or the data.
How do I handle empty cells in my data?
Excel's CORREL function automatically ignores pairs of cells where one or both cells are empty. However, it is better to clean your data first to ensure you know exactly how many pairs are being analyzed.
Does a correlation of 0 mean there is no relationship at all?
It means there is no linear relationship. The variables could still have a strong relationship that is curved (like a U-shape), which the CORREL function is not designed to detect.