How to Measure Correlation in Excel
In this article
To measure correlation in Excel, use the CORREL function: type =CORREL(array1, array2) where the two arrays are ranges of equal length, and press Enter. The result is the Pearson correlation coefficient (r), a number between -1 and 1 that tells you how strongly two variables move together. For a quick visual, you can also use the Data Analysis ToolPak's Correlation tool, or chart the two columns as a scatter plot and add a trendline. This guide walks through each method, explains what the number means, and covers the mistakes that most often produce wrong or misleading results.
What You'll Need
- Excel for Windows, Mac, or Excel for the web (the CORREL function works in all versions; the Data Analysis ToolPak is available on desktop versions and not in Excel for the web).
- Two columns of numeric data, ideally with the same number of rows and no blank cells inside the ranges.
- For the ToolPak method: the Analysis ToolPak enabled via File > Options > Add-ins (Windows) or Tools > Excel Add-ins (Mac). Menu labels can differ slightly by version and platform.
Step-by-Step
- Lay out your data cleanly. Put one variable in column A and the other in column B, with a header row at the top. Each row should represent one observation — for example, one day's temperature in A and that day's electricity use in B. Do not leave blank rows inside the data; blanks are ignored by CORREL but can silently shrink your sample and change the result.
- Check that both columns are numeric. Numbers stored as text (often left-aligned, sometimes with a green triangle warning) are ignored by CORREL. Select the column, use Data > Text to Columns and click Finish, or multiply the range by 1 in a helper column, to convert text-formatted numbers to real numbers.
- Pick an empty cell for the result and type
=CORREL(. Excel will prompt for the two arrays. - Select the first range (for example A2:A100), type a comma, then select the second range (for example B2:B100). Close the parenthesis and press Enter. The formula looks like
=CORREL(A2:A100,B2:B100). - Read the result. A value near +1 means the two variables rise and fall together; near -1 means one rises as the other falls; near 0 means little or no linear relationship. The sign matters, the magnitude tells you strength.
- Optional: use the Data Analysis ToolPak for a matrix. Go to Data > Data Analysis, choose Correlation, and select your input range including headers. Tick "Labels in first row" if you included headers, choose an output range, and click OK. This produces a correlation matrix — useful when you have three or more variables and want every pairwise correlation at once.
- Optional: visualize it. Select both columns, go to Insert > Scatter (the first scatter option, markers only), then right-click a data point and choose Add Trendline. In the trendline options, tick "Display R-squared value on chart." The square root of R-squared is the absolute value of the correlation coefficient; the trendline's direction tells you the sign.
- Sanity-check the output. CORREL returns
#N/Aif the ranges are different sizes,#DIV/0!if one range has zero variance (all values identical), and#NUM!in some error cases. Fix the ranges rather than wrapping the formula in IFERROR, which would hide a real data problem.
Common Mistakes
- Mismatched range sizes. CORREL requires arrays of equal length. If A2:A100 is paired with B2:B99, Excel returns #N/A. Always select both ranges with the same row count.
- Including headers in the ranges. Text headers are ignored by CORREL, so the formula may still work — but if a header happens to be numeric (like a year), it gets treated as a data point and skews the result. Start ranges at the first data row.
- Correlation mistaken for causation. A high r does not mean one variable causes the other. Ice cream sales and drowning rates correlate because both rise in summer; neither causes the other.
- Ignoring outliers. Pearson correlation is sensitive to extreme values. A single outlier can push r from 0.2 to 0.8. Plot the data before trusting the number.
- Using Pearson on curved relationships. CORREL measures linear association only. A perfect U-shaped relationship can produce r near 0 even though the variables are strongly related. A scatter plot reveals this immediately.
- Treating r as a percentage. An r of 0.5 is not "50% correlated" in a meaningful sense; r-squared (0.25) is the proportion of variance shared, which is a different and often more useful figure.
Tips
- Use
=RSQ(y_range, x_range)to get r-squared directly when you care about explained variance rather than direction. - For ranked or non-linear data, Spearman correlation is more appropriate than Pearson. Excel has no built-in Spearman function, but you can compute it by ranking both columns with RANK.AVG and then applying CORREL to the ranks.
- Name your ranges (Formulas > Define Name) so formulas like
=CORREL(Temperature, Usage)stay readable and less error-prone. - Keep a scatter plot next to any correlation figure you report. It takes seconds and catches outliers, clusters, and curved patterns that a single number hides.
- Report the sample size alongside r. A correlation from 8 data points is far less trustworthy than one from 800, even at the same coefficient.
Troubleshooting
- #N/A error: the two ranges have different numbers of cells. Reselect both with matching row counts.
- #DIV/0! error: one of the ranges has no variation — every value is identical. Check for a column that was accidentally filled with a single value or copied down incorrectly.
- Result looks wrong or too low: check for text-formatted numbers, blank cells inside the range, or outliers. Convert text to numbers and inspect a scatter plot.
- Data Analysis button missing: the ToolPak is not enabled. On Windows, go to File > Options > Add-ins, select Excel Add-ins at the bottom, click Go, and tick Analysis ToolPak. On Mac, use Tools > Excel Add-ins. Excel for the web does not include the ToolPak; use CORREL instead.
- Formula returns a number but the relationship is clearly non-linear: that is expected — Pearson r only captures linear association. Switch to Spearman via ranked data or examine the scatter plot directly.
Frequently Asked Questions
What is the difference between CORREL and PEARSON in Excel?
They are the same calculation. CORREL and PEARSON both return the Pearson correlation coefficient; CORREL is the more commonly used name.
Can I calculate correlation with more than two variables at once?
Not with a single CORREL formula, which takes exactly two arrays. Use the Data Analysis ToolPak's Correlation tool to produce a matrix of all pairwise correlations, or write one CORREL formula per pair.
Does correlation require the same number of rows in both columns?
Yes. CORREL pairs values row by row, so the two ranges must be the same size. Mismatched sizes return #N/A.
How do I interpret a correlation of 0.7?
It indicates a fairly strong positive linear relationship: as one variable increases, the other tends to increase. Squaring it gives 0.49, meaning roughly half the variance in one variable is shared with the other — but it still says nothing about causation.
Why does my correlation change when I remove one data point?
Pearson correlation is sensitive to outliers. A single extreme value can substantially raise or lower r. Always plot the data and consider whether extreme points are genuine or errors before reporting the coefficient.
Can Excel calculate Spearman correlation directly?
No built-in function exists. Rank both columns using RANK.AVG in helper columns, then apply CORREL to the ranked values. That gives the Spearman rank correlation coefficient.