Contact

CHISQ.TEST in Excel: Compare Observed and Expected Counts

Statistical Intermediate Microsoft Excel

Use Excel CHISQ.TEST and legacy CHITEST to migrate observed-versus-expected count tests; compare exact arguments, original examples and documented migration errors.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: for observed rows 20,30,50 and 30,50,20, with expected rows 25,40,35 and 25,40,35, =CHISQ.TEST(A2:C3,F2:H3) has independent expected probability 0.0000487614.

Syntax and required count ranges

=CHISQ.TEST(actual_range, expected_range)

Both arguments are required. The actual range contains observed frequencies. The expected range contains the matching expected frequencies. The function returns a right-tail probability, not the chi-square statistic itself.

For a contingency-table independence model, Microsoft describes each expected count as its row total times its column total divided by the grand total. Observed and expected cells must correspond to the same categories and table shape.

Use counts, not category codes or percentages with an arbitrary total. A correct range reference does not by itself justify the independence assumptions or the approximation for sparse data.

Example 1: build the full observed table

Enter 20, 30, 50 in A2:C2 and 30, 50, 20 in A3:C3. Put =SUM(A2:C2) in D2 and fill down to D3. Each row total is 100.

Put =SUM(A2:A3) in A4 and fill across to C4. Column totals are 50, 80 and 70. Put =SUM(D2:D3) in D4; the grand total is 200.

Keep category labels outside the numeric blocks. Do not include the row totals or column totals in the actual_range passed to CHISQ.TEST; they would create additional cells and change the calculation.

Example 2: calculate expected frequencies

In F2 enter =$D2*A$4/$D$4. Fill across through H2 and then down through row three. The mixed references hold the appropriate row total, column total and grand total as the formula is copied.

Both expected rows are 25, 40 and 35. Their totals match the observed table’s margins. The expected values are not simply every cell’s overall average; they incorporate each row and column total.

Now enter =CHISQ.TEST(A2:C3,F2:H3) in F5. Its independent probability is approximately 0.0000487614. Keep expected cells at full precision rather than rounding them before passing the range to the test.

Advanced application: audit the statistic independently

In K2 enter =(A2-F2)^2/F2. Fill across through M2 and down through row three. Contributions in each row are 1, 2.5 and 6.4285714286.

=SUM(K2:M3) independently gives statistic 19.8571428571. For a two-row, three-column table, degrees are (2−1)*(3−1)=2.

=CHISQ.DIST.RT(SUM(K2:M3),2) targets the same 0.0000487614 probability. This separate statistic-plus-tail construction makes clear why the probability returned by CHISQ.TEST should not be labeled “chi-square statistic.”

Advanced application: preserve dimensions and assumptions

Microsoft states that when both dimensions exceed one, degrees are (rows−1)*(columns−1). For one row or one column, degrees are the non-singleton dimension minus one. A single-cell comparison is disallowed.

Flattening this 2-by-3 table into a six-cell row would therefore change the automatic degrees from two to five. It does not preserve the independence test, even if the same six counts appear in the flattened list.

All expected counts in this example exceed five. Microsoft notes that the approximation is most appropriate when expected values are not too small and reports the commonly suggested threshold of five. That guideline does not replace assessment of the design, dependence or suitable alternatives for a particular sparse table.

Reproduce Microsoft’s rounded expected counts

The source’s observed 3-by-2 rows are 58,35; 11,25; 10,23. Its printed expected rows are 45.35,47.65; 17.56,18.44; 16.09,16.91.

Using those printed expected numbers gives independent statistic 16.1695750748 with two degrees and probability 0.0003081920, consistent with its rounded result 0.0003082.

Expected counts recomputed from unrounded margins are slightly different from those printed inputs. Do not silently mix the two calculation paths when trying to reproduce the displayed statistic exactly.

Errors and troubleshooting

Microsoft documents #N/A for different numbers of data points between ranges and for a one-by-one table. Use matching dimensions and positive expected counts; the contribution formula divides by each expected value.

The dedicated remarks do not enumerate every native error for zero or negative expected counts, missing values or text. Validate the table explicitly rather than claiming an untested error code. A small p-value is not a posterior probability that independence is false, and a large one does not prove independence. Native execution and all coercion details remain unverified.

Availability and version history

  • Current documentation: the dedicated Microsoft reference lists Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel 2024, Excel 2024 for Mac, Excel 2021, Excel 2021 for Mac, Excel 2019, Excel 2016.
  • Introduced: Microsoft’s alphabetical catalog marks CHISQ.TEST as introduced in Excel 2010. Exact first build and platform-specific introduction dates remain unverified.
  • Last functioning version: unknown; a current help listing is not a last-working-build test.
  • Evidence checked: October 15, 2026. Official documentation was freshly retrieved; examples were independently calculated. No native Excel, Mac or web-client execution was performed.

References and verification

Examples use English function names and comma separators. Expected numbers are rounded independent mathematical calculations; documented error expectations are labeled as such. They are not captured Excel output. All illustrative data and policies are fictional.

Legacy CHITEST: exact contract and migration

=CHITEST(actual_range,expected_range)

The two required ranges contain corresponding observed and expected frequencies. CHITEST returns a right-tail p-value, not the chi-square statistic. CHISQ.TEST keeps the same arguments. There is no tails or cumulative flag to add.

For an r-by-c table with both dimensions above one, the documented degrees are (r−1)(c−1); a single row or column uses its length minus one. A one-cell table is invalid. Unequal data-point counts produce documented #N/A.

Original legacy example and independent check

In a fresh sheet put 12,18,30 in A2:C2 and 28,22,10 in A3:C3. Each row totals 60; each column totals 40. Put 20 in every cell E2:G3: each expected count is 60×40/120.

=CHITEST(A2:C3,E2:G3) and migrated =CHISQ.TEST(A2:C3,E2:G3) independently target 0.0002248673. The six (observed−expected)²/expected contributions sum to 16.8; degrees=(2−1)(3−1)=2. Thus =EXP(-16.8/2) independently checks the p-value. Exclude margins from both ranges. These fictional counts illustrate arithmetic, not a conclusion about a real population.

Migration errors and compatibility scope

A rename does not generate expected counts or correct misaligned categories. Keep matching table shapes and positive, adequately large expected counts; Microsoft’s reference cautions about small expectations. A p-value is conditional on the model, not the probability that independence is true.

Microsoft identifies CHISQ.TEST as the replacement and retains CHITEST for backward compatibility. Replacement is not evidence of removal: the legacy help currently lists Microsoft 365 and Excel 2024, 2021, 2019 and 2016. No last-working build or native equivalence is established here.

Source: Microsoft CHITEST reference, checked October 19, 2026. The added numerical examples are independent mathematical expectations, not captured Excel output. Earlier review dates above describe the preserved modern guide.