A #DIV/0! error in Excel’s =CORREL(array1, array2) or =PEARSON(array1, array2) function occurs when the standard deviation of at least one of the input arrays equals zero, or when your arrays contain fewer than two valid, paired numeric data points. Mathematically, calculating Pearson’s correlation requires dividing the covariance of the two variables by the product of their individual standard deviations. If either variable has zero variance, the denominator becomes zero, terminating the calculation with #DIV/0!.
Quick Answer
CORRELreturns#DIV/0!whenever one of your datasets has zero variation (all values are identical), when an array contains only a single observation (), or when text/blanks eliminate all shared numeric pairs. To fix this, confirm both arrays have variance using=VAR.S(array) > 0and verify that the data ranges share at least two complete numeric rows.
The Mathematical Reason CORREL Crashes on Zero Variance
Pearson’s correlation coefficient () evaluates the strength and direction of a linear relationship between two continuous variables:
Look closely at the denominator:
This denominator is directly proportional to the standard deviations of both series ():
- If all values in
array1are identical (e.g.,[5, 5, 5, 5]), every deviation is . - The sum of squared deviations for evaluates to .
- The denominator becomes .
- Excel attempts to divide by zero and returns
#DIV/0!.
Array X: [ 5, 5, 5, 5 ] --> Variance = 0 (Constant baseline)
Array Y: [ 12, 18, 24, 30 ] --> Variance = 54 (Active series)
Evaluation: Covariance / (0 * 7.35) --> Division by Zero --> #DIV/0!
From an analytical standpoint, this makes complete sense: you cannot measure co-variation if one variable does not vary at all.
Step-by-Step Troubleshooting Path
Follow this diagnostic sequence to locate and resolve the root cause of the error:
[#DIV/0! in CORREL Function]
│
├──> Are all values in Array1 or Array2 identical?
│ └──> Test VAR.S. If variance = 0, correlation cannot be computed.
│
├──> Are arrays mismatched in size or unaligned?
│ └──> CORREL requires equal row/column lengths. Align ranges.
│
├──> Are there fewer than 2 paired numeric values?
│ └──> Blanks, text, or #N/A strip valid pairs. Ensure N >= 2.
│
└──> Are numbers stored as text strings?
└──> Convert text to numbers using VALUE or Text-to-Columns.
Step 1: Run the Zero-Variance Diagnostic Test
Before calling CORREL, evaluate the sample variance of each individual series in empty cells:
=VAR.S(A2:A100)
=VAR.S(B2:B100)
- If either formula returns
0, that column is constant. - A constant variable has no linear association with any other variable. You must remove it from your correlation matrix.
For a detailed review of sample versus population variance behavior, see Standard Deviation: STDEV.S vs. STDEV.P—Why your variance is statistically biased..
Step 2: Check for Paired Numeric Rows ()
CORREL pairs cells by their relative position: cell 1 in array1 is paired with cell 1 in array2.
If array1 has text or blanks in rows where array2 has numbers, and vice versa, Excel discards the unaligned pairs. If fewer than two complete numeric pairs remain, the formula crashes with #DIV/0!.
Use this formula to count how many rows contain complete numeric pairs:
=COUNTIFS(A2:A100, "><""", B2:B100, "><""")
Or, more accurately for numeric typing:
=SUMPRODUCT(--ISNUMBER(A2:A100), --ISNUMBER(B2:B100))
If the count is 0 or 1, you do not have enough paired observations to evaluate correlation.
Step 3: Check for Dimension Mismatches
Both ranges passed to CORREL must have the exact same number of rows and columns. If you enter:
=CORREL(A2:A50, B2:B51)
Excel does not calculate. In most modern builds this triggers #N/A, but if combined with downstream calculation logic or multi-area selections, it can trigger immediate structural evaluation failures.
Building a Bulletproof Correlation Formula
To prevent #DIV/0! from breaking dashboards or correlation matrices when scanning dynamic datasets, wrap the formula in logical safeguards:
=LET(
x, A2:A100,
y, B2:B100,
valid_n, SUMPRODUCT(--ISNUMBER(x), --ISNUMBER(y)),
var_x, IFERROR(VAR.S(x), 0),
var_y, IFERROR(VAR.S(y), 0),
IF(valid_n < 2, "Insufficient Data",
IF(OR(var_x = 0, var_y = 0), "Zero Variance",
CORREL(x, y)
)
)
)
Formula Output:
├── "Insufficient Data" ──> Fewer than 2 complete numeric pairs found.
├── "Zero Variance" ──> One series is constant; correlation undefined.
└── -1.000 to +1.000 ──> Valid correlation coefficient.
An Important Statistical Distinction: Correlation vs. Causation
Even when CORREL executes successfully and returns a high coefficient (such as ), this measures co-movement, not causality.
- A high correlation can result from a shared third factor (a confounding variable), random chance in small sample sizes, or mutual trends over time.
- If your goal is to evaluate explanatory power and control for secondary predictors, move beyond simple correlation to multiple linear regression.
If your regression models encounter missing values or rank deficiencies due to perfectly collinear predictors, read R-Squared Errors: Why Excel returns #N/A in LINEST for perfectly collinear data.. For broader statistical troubleshooting, see Excel for Science & Engineering: Diagnostic Maps for Stats, Matrices, and Solvers.