Contact

CHISQ.TEST Function (LibreOffice Calc)

Statistical Advanced LibreOffice Calc LibreOffice 4.2

LibreOffice Calc CHISQ.TEST examples turn observed and expected counts into a right-tail p-value, with table-shape degrees of freedom and model cautions.

Verification status: Official release source and independently calculated examples for CHISQ.TEST were reviewed. No new LibreOffice Calc application execution is claimed for this guide; the stated version and example limits still apply. How formula examples are checked

Quick answer: For observed counts 18, 22, 20, 20 and expected counts 20, 20, 20, 20, CHISQ.TEST gives approximately 0.940242494839. The result is a right-tail p-value under the specified chi-square model.

Availability and version history

  • Introduced: LibreOffice 4.2.
  • Availability: Supported in LibreOffice 26.8.1.1, verified against its function registry. This identifies a supported release, not a final working version.
  • Scope: Desktop Calc, using the English function name. Availability in other spreadsheet applications is separate.
  • Checked: 2026-10-14 — function reference; versioned support. Documentation/source check; not a new native test. Existing example-specific test claims below retain their stated scope.

What CHISQ.TEST calculates

CHISQ.TEST first forms the statistic Σ(observed−expected)²/expected, then evaluates its chi-square right tail. Expected counts must come from the model you intend to test. A large p-value does not establish that the model is true, and a small one does not identify the cause of a difference. Release implementation.

The usual reference approximation assumes suitable independent count observations and sufficiently large expected counts. Repeated measurements of the same individual, percentages entered as though they were counts, or sparse categories can invalidate that interpretation even when Calc returns a number.

Syntax and input shape

=CHISQ.TEST(Observed; Expected)

Both arguments are required and must have identical row and column dimensions. For a single row or column of k entries, Calc uses k−1 degrees of freedom. For a genuine r-by-c rectangle, it uses (r−1)(c−1). Consequently, rearranging four categories from one column into a 2-by-2 block changes the reference distribution.

Use complete numeric counts with strictly positive expected values. The implementation skips pairs containing empty cells but still derives degrees of freedom from the full rectangular shape. This is a reason to prepare a complete table rather than rely on blank skipping. A zero expected value has an explicit division-by-zero guard. A one-cell input has zero degrees of freedom and is rejected.

Reproducible worksheet

Enter these four columns beginning in row 2. B holds the expected counts; each complete observed column has the same total, 80.

Row A B C D
2 18 20 10 19
3 22 20 10 21
4 20 20 20 20
5 20 20 40 20

The following values were calculated independently and rounded to twelve decimal places.

Formula Expected result, approximately
=CHISQ.TEST(A2:A5;B2:B5) 0.940242494839
=CHISQ.TEST(C2:C5;B2:B5) 0.000001380057
=CHISQ.TEST(D2:D5;B2:B5) 0.991837423732
=CHISQ.TEST(B2:B5;B2:B5) 1
=CHISQ.TEST(A2:A3;B2:B3) 0.527089256866
=CHISQ.TEST(A2:A4;B2:B4) 0.818730753078
=CHISQ.TEST(A4:A5;B4:B5) 1
=CHISQ.TEST(D2:D3;B2:B3) 0.751829634046

For A against B, the chi-square statistic is 0.4 and df=3. Check it with =SUMPRODUCT((A2:A5-B2:B5)^2/B2:B5) and evaluate =CHIDIST(0.4;3) separately. This cross-check exposes a wrong expected range or tail choice.

Advanced example: a 2-by-2 independence table

Suppose the observed rows are 30, 20 and 10, 40. Both row totals are 50; column totals are 40 and 60; the grand total is 100. Under independence, expected counts are row total × column total ÷ grand total, giving rows 20, 30 and 20, 30.

Place the observed table in A10:B11 and the expected table in D10:E11. =CHISQ.TEST(A10:B11;D10:E11) uses df=1 and gives approximately 0.000044557091. The statistic is 16.666666666667. Do not include marginal totals as extra observations.

When the built-in degrees of freedom do not fit

If expected counts were fitted using parameters estimated from these same observations, the appropriate goodness-of-fit degrees of freedom can be smaller than k−1. CHISQ.TEST does not discover that model adjustment. Compute the statistic and evaluate CHIDIST with the justified df instead.

Also avoid changing categories after inspecting the result solely to obtain a smaller p-value. Record the grouping and model before testing, retain the original counts and interpret the result with the study design and effect sizes.

Official evidence and calculation scope

The numerical references were recomputed independently against the retained release contract. Native application execution, import paths and locale behavior are not newly verified by these reference calculations. The 26.8.1.1 dispatcher routes CHISQ.TEST and the legacy CHITEST spelling to the same evaluator. The introduction history above applies to the dotted name.