The quickest way to find the Pearson correlation coefficient (r) in Google Sheets is with the CORREL function: =CORREL(range1, range2). For example, if your first data set is in A2:A20 and the second in B2:B20, enter =CORREL(A2:A20, B2:B20) in any empty cell. This returns a value between -1 and 1 that measures the strength and direction of the linear relationship between the two variables.
What the Correlation Coefficient Actually Tells You
The coefficient r, formally called the Pearson product-moment correlation coefficient, quantifies how closely two variables follow a straight line when plotted on a scatter chart. It does not measure the slope of that line, nor does it imply causation. A value of +1 means a perfect positive linear relationship (as one variable increases, the other increases proportionally), -1 means a perfect negative linear relationship, and 0 means no linear relationship at all. Values like 0.6 or -0.4 indicate moderate strength. Note that r is unitless—it does not depend on the scale of your data, so multiplying one column by 1000 will not change the result.
For context, a common misconception is that r = 0 means the variables are unrelated. That is only true for linear relationships. Two variables could have a perfect U-shaped curve and still show r close to 0. Always plot your data first to see the shape.
How the CORREL Function Works in Google Sheets
Google Sheets has two functions that return the Pearson correlation coefficient: CORREL and PEARSON. They are mathematically identical—both compute the same formula:
r = Σ((x – x̄)(y – ȳ)) / √(Σ(x – x̄)² Σ(y – ȳ)²)
Where x̄ and ȳ are the means of each range. The function ignores cells that contain text, logical values (TRUE/FALSE), or empty cells in either range, but it does require that both ranges have the same number of numeric entries. If the ranges are of different lengths, you get a #N/A error. If either range has zero variance (e.g., all values are identical), you get #DIV/0! because the denominator is zero.
To use it: select an empty cell, type =CORREL(, then highlight the first range, type a comma, highlight the second range, and press Enter. On a Mac, the steps are identical—Google Sheets runs in the browser, so the interface is the same across operating systems. If you prefer the PEARSON function, it works exactly the same way: =PEARSON(A2:A20, B2:B20).
Step-by-Step: Calculating r with a Worked Example
Suppose you have two columns of data representing hours studied (A) and test scores (B) for 10 students. Enter the data in A2:A11 and B2:B11. Then:
- Click an empty cell, say D2.
- Type
=CORREL(A2:A11, B2:B11)and press Enter. - The result appears as a decimal, e.g., 0.85.
To see the relationship visually, select both columns (A2:B11), click Insert > Chart, and in the Chart editor choose “Scatter chart.” You will see a cloud of points; if they trend upward from left to right, r is positive. The closer the points are to a straight line, the closer |r| is to 1.
If you want to check the significance of r (i.e., whether it is statistically different from 0), you can compute a t-statistic with the formula =r * SQRT((n-2)/(1-r^2)), where n is the number of pairs. But Google Sheets does not have a built-in p-value function for correlation, so you would need to use a separate statistical tool or a custom script.
How to Choose Between CORREL, PEARSON, and Other Methods
For most purposes, CORREL is the simplest and clearest choice. PEARSON is there for compatibility with older spreadsheets, but it returns the same number. If you need the coefficient of determination (r²), simply square the result: =CORREL(A2:A11, B2:B11)^2. This tells you the proportion of variance in one variable explained by the other. For example, r = 0.85 gives r² = 0.7225, meaning about 72% of the variance in test scores is explained by hours studied.
If your data is not linearly related, consider Spearman’s rank correlation, which Google Sheets does not have as a built-in function. You would need to rank the data manually using RANK and then apply CORREL to the ranks. That is a workaround, but it is not automatic.
Common Problems and Errors When Using CORREL
- #N/A error: The two ranges have different lengths. Make sure they contain the same number of numeric cells.
- #DIV/0! error: One of the ranges has zero variance (all numbers identical). Correlation is undefined in that case.
- Text or blank cells: They are ignored, but if a cell contains a formula that returns an empty string, it may be treated as text and ignored. Check that your data is purely numeric.
- Outliers: A single extreme value can inflate or deflate r dramatically. Always inspect your scatter plot before trusting the coefficient.
- Non-linear relationships: r will be near zero even if a strong curved relationship exists. Use a scatter plot to check.
If you get a result that seems wrong, double-check that you selected the correct ranges. A common mistake is swapping the order of ranges—though correlation is symmetric, so swapping does not change the result. Another is including a header row that contains text; that is fine because text is ignored, but if your header is a number, it will be included and skew the result.
Correlation vs. Regression: When to Use Which
Correlation tells you the strength and direction of a relationship, but it does not give you a predictive equation. If you want to predict one variable from another, you need linear regression. In Google Sheets, you can get the slope and intercept with SLOPE and INTERCEPT, or use the LINEST function for a full regression output. For example, with the same data, =SLOPE(B2:B11, A2:A11) returns the change in test score per additional hour studied. The correlation coefficient and the slope are related: slope = r * (standard deviation of y / standard deviation of x). So a high r does not mean a steep slope—it just means the points are tightly clustered around a line, whatever that slope is.
For multiple independent variables, use LINEST or the Analysis Toolpak add-on, but that is beyond the scope of a single correlation coefficient.
Frequently Asked Questions
Can I use CORREL with non-adjacent columns?
Yes. You can reference separate ranges like =CORREL(A2:A20, C2:C20) as long as they have the same number of rows. The ranges do not need to be next to each other.
What does a correlation of 0.5 mean?
It indicates a moderate positive linear relationship. The variables tend to move together, but there is substantial scatter. The r² value of 0.25 means only 25% of the variance is shared.
Is CORREL the same as PEARSON?
Yes, they are identical in Google Sheets. Both compute the Pearson correlation coefficient. Use whichever you remember.
How do I get a p-value for the correlation?
Google Sheets does not have a built-in p-value function for correlation. You can compute the t-statistic manually using =r*SQRT((n-2)/(1-r^2)) and then use a t-distribution table or a custom script to find the p-value. For a quick check, if n is large (say >30) and |r| > 0.3, it is often statistically significant, but that is not a substitute for a proper test.
Why does my correlation show #DIV/0! even though my data looks fine?
This happens when one of the ranges has zero variance—for example, if all values in one column are the same number. Check for accidental constants or blank cells that might be interpreted as zeros. Also ensure you did not include a row where every value is identical.
Can I calculate Spearman’s rank correlation in Sheets?
There is no direct function, but you can rank each column with =RANK(A2, A$2:A$20) and then apply CORREL to the two rank columns. This gives you Spearman’s rho. Note that ties are handled differently, but for most data it works well.
Related
- How to Add Date in Data Validation Excel
- Data Entry Role Name: Job Titles & What They Mean
- How to Add Copilot in Excel: Step-by-Step
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Not Responding? Causes, Fixes, and Recovery StepsIf Excel says “Not Responding,” wait briefly if it is calculating or opening a large file; if it…
- Excel Protected Sheet Message: Meaning, Causes and FixesThe Excel protected sheet message means the worksheet is protected and the action you tried is not allowed…
- PowerPoint Slideshow Loop: How to Repeat It AutomaticallyTo keep a PowerPoint slideshow looping, open the presentation in the desktop app and choose Slide Show >…
- Block an Email Sender by Name in Outlook: What WorksOutlook cannot reliably block a sender using only the display name shown in the From line. To block…
- Why Is My Computer Doing Random Things?Your computer is doing random things because of one or more of these core causes: a malfunctioning driver,…
- How to Add and Subtract Lines in ExcelAdding or subtracting entire rows (lines) in Excel usually means inserting or deleting rows, but sometimes you need…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.