The divide-by-zero error in Excel's T.TEST function (or the older TTEST) almost always means one of the two data ranges has zero variance — every value in that range is identical. Excel computes the test statistic by dividing by a standard error built from the sample variances, so if either group has no spread, the denominator becomes zero and you get #DIV/0!. The fix is to check each range for identical values, confirm your ranges are the same size and contain numbers (not text or blanks), and only then run the test on data that actually varies.
What You'll Need
- Excel on desktop (Windows or Mac) or Excel for the web — the function names and error behaviour are the same, though menu labels can differ slightly by version and region.
- Two columns or ranges of numeric data you want to compare, ideally with at least a handful of values in each.
- Basic familiarity with entering a formula in the formula bar.
Step-by-Step
- Reproduce the error in a clean cell. Click an empty cell and type
=T.TEST(A2:A10,B2:B10,2,2), replacing the ranges with your own. The arguments are: range 1, range 2, tails (1 or 2), and type (1 = paired, 2 = two-sample equal variance, 3 = two-sample unequal variance). Press Enter. If you see #DIV/0!, move to the next step. - Check that both ranges contain only numbers. Select the first range and look at the status bar at the bottom of the window — Excel shows Count and Sum for numeric cells. If Count is lower than the number of cells you selected, some cells are text, blank, or contain spaces. Repeat for the second range. Text and blanks are ignored by T.TEST, which can shrink a range to a single value and trigger the error.
- Check the variance of each range. In two empty cells, enter
=VAR.S(A2:A10)and=VAR.S(B2:B10). If either result is 0, that range has no spread — every value is identical — and T.TEST will return #DIV/0!. This is the most common cause. - Look for hidden duplicates or copy-paste mistakes. If a variance is 0, scan the range. A column that was filled down from one cell, a pasted constant, or a formula that references a single cell will all produce identical values. Correct the data so each group has real variation.
- Confirm the ranges are the same size. For a paired test (type 1), the two ranges must have the same number of values, and the pairing must be row-by-row. Mismatched sizes can produce odd results or errors. For two-sample tests (types 2 and 3), sizes can differ, but both must contain at least two numeric values.
- Check for error values inside the ranges. If any cell in either range contains #N/A, #VALUE!, or another error, T.TEST propagates it. Use
=COUNT(A2:A10)and=COUNT(B2:B10)to confirm numeric counts, and filter or clean the source data. - Re-run the test. Once both variances are greater than zero and both ranges contain numbers, enter the T.TEST formula again. You should now get a probability between 0 and 1 instead of an error.
- If you are using the Analysis ToolPak, check its input. The t-Test tools under Data > Data Analysis expect contiguous ranges with labels handled correctly. If the Variable 1 or Variable 2 range is a single cell or a column of identical values, the tool reports an error. Widen the range and make sure the “Labels” checkbox matches whether your first row is a header.
Common Mistakes
- Assuming the error means a formula typo. #DIV/0! from T.TEST is nearly always a data problem, not a syntax problem. Check variance first.
- Including header rows in the range. A text header is ignored, but it shifts the count and can hide the fact that only one numeric value remains.
- Using type 1 (paired) with unequal range sizes. Pairing assumes one-to-one rows; mismatched sizes give misleading output.
- Leaving blanks in the middle of a range. T.TEST skips blanks, but a mostly blank range can collapse to one or two values and produce zero variance.
- Confusing T.TEST with a t-test tool output. The function returns only a p-value; the Data Analysis tool returns a full table. Both can show divide-by-zero symptoms from the same data issue.
Tips
- Put
=VAR.S()checks next to your data permanently while you clean it — a zero variance cell is an instant red flag. - Use
=COUNT()rather than=COUNTA()to count numeric values only; COUNTA counts text too and can mislead you. - If your data legitimately has no variation (for example, a control group where every reading is identical), a t-test is not meaningful. Report the values descriptively instead of forcing a test.
- For quick sanity checks, the older
=TTEST()function behaves identically to=T.TEST(); either name works in current Excel versions. - Keep raw data in one sheet and test formulas in another so cleaning steps do not overwrite source values.
Troubleshooting
If the error persists after cleaning, work through these checks in order. First, select each range and read the Count in the status bar — if it is 0 or 1, the range is effectively empty or constant. Second, temporarily copy the values into a new sheet with Paste Special > Values to strip formulas that might be returning the same result each row. Third, test with a tiny made-up example: put 1, 2, 3 in A1:A3 and 4, 5, 6 in B1:B3 and run =T.TEST(A1:A3,B1:B3,2,2). If that works, your formula is fine and the problem is in your data. If it still errors, check that your Excel installation is up to date and that the Analysis ToolPak is enabled via File > Options > Add-ins if you are using the Data Analysis tools. Finally, confirm you are not passing a whole column reference such as A:A that includes thousands of blanks — restrict ranges to the actual data.
Frequently Asked Questions
Why does T.TEST return #DIV/0! when both columns have numbers?
Because numbers alone are not enough — the values in at least one range must differ from each other. If every value in a range is identical, its variance is zero and the test statistic divides by zero.
Does a blank cell cause the divide-by-zero error?
Not directly, but blanks reduce the effective sample size. If blanks leave only one numeric value in a range, variance cannot be calculated and the error appears.
Can I use T.TEST with different-sized ranges?
Yes for type 2 and type 3 (two-sample tests). Type 1 (paired) requires equal sizes because it compares row by row.
What is the difference between T.TEST and the Data Analysis t-Test?
T.TEST is a worksheet function that returns a single p-value. The Data Analysis t-Test tools produce a full summary table. Both rely on the same underlying data assumptions, so both can fail on zero-variance data.
Should I delete identical values to fix the error?
No. Do not alter data just to make a test run. If a group truly has no variation, a t-test is inappropriate; report the data descriptively or revisit how the data was collected.
Does the error mean my Excel is broken?
Almost never. #DIV/0! is a standard Excel error meaning a division by zero occurred, and in T.TEST it points to your input ranges rather than the software.