Statistical function

CHISQ.TEST function

Runs a chi-squared test on a table of observed counts against expected counts and returns the p-value.

Available in Excel 2010 and later, Microsoft 365, Excel for the web, Excel for Mac 2011 and later

Excel 2010 and laterWorks in Google Sheets

Syntax

CHISQ.TEST(actual_range, expected_range)
ArgumentWhat it means
actual_rangeRequiredThe observed counts.
expected_rangeRequiredThe counts you would expect if there were no effect. Same size and shape as actual_range.

Returns: The p-value: the probability of differences at least this large if the expected pattern were true.

How CHISQ.TEST works

CHISQ.TEST checks whether counts you observed differ from what you expected by more than chance would explain. Typical questions: does the store layout affect whether customers buy? Do support tickets arrive evenly across the weekdays? Do men and women choose different plans? You supply two tables of the same shape, observed and expected, and get back a p-value.

Read the p-value as "how surprising would these numbers be if nothing was going on?" Below 0.05 is the usual threshold for calling a difference statistically significant. Excel works out the degrees of freedom from the shape: (rows − 1) × (columns − 1) for a table, or count − 1 for a single row or column.

You have to supply the expected counts yourself. For a two-way table, each expected cell is row total × column total ÷ grand total; for an "evenly spread" check, every expected cell is the total divided by the number of categories. The test is unreliable when expected counts are small (a common rule: all at least 5). It replaced CHITEST.

Examples

1Does the store layout change buying?

G2fx=CHISQ.TEST(B2:C3, D2:E3)
ABCDEFG
1LayoutBoughtDidn't buyExp. boughtExp. didn't
2Layout A48152571430.0462
3Layout B6613457143

Result: 0.0462

Overall 114 of 400 visitors bought, so with no layout effect each 200-visitor group should have 57 buyers and 143 non-buyers. The observed split is further apart than that, and the p-value is 0.0462 (formatted to 4 decimal places). Below 0.05, so the difference between layouts is statistically significant.

2Are support tickets spread evenly over the week?

E2fx=CHISQ.TEST(B2:B6, C2:C6)
ABCDE
1DayTicketsExpected
2Mon52480.0621
3Tue4148
4Wed3848
5Thu4548
6Fri6448

Result: 0.0621

240 tickets over 5 days would be 48 a day if spread evenly. Friday looks busy, but the p-value is 0.0621, above 0.05. With only one week of data the pattern could still be chance; collect more weeks before adding Friday staff.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
#N/AThe two ranges have different shapes, or the range has only one cell.Make both ranges the same size.
#DIV/0!An expected value is 0.Expected counts must be positive; merge small categories.
#NUM!An expected value is negative.Check the expected table.

Tips

  • Feed counts, not percentages. Percentages hide the sample size, which is what decides significance.
  • Build the expected table with a formula: in a two-way table, =$F2*B$4/$F$4 (row total × column total ÷ grand total) filled across.
  • To report the statistic itself, use =CHISQ.INV.RT(p, df) on the p-value, or compute =SUM((B2:C3-D2:E3)^2/D2:E3).

Google Sheets

CHISQ.TEST also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

CHISQ.TEST in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishCHI2.TEST
DutchCHIKW.TEST
FinnishCHINELIÖ.TESTI
GermanCHIQU.TEST
HungarianKHINÉGYZET.PRÓBA
ItalianTEST.CHI.QUAD
Norwegian (Bokmål)KJIKVADRAT.TEST
PolishCHI.TEST
Portuguese (Brazil)TESTE.QUIQUA
Portuguese (Portugal)TESTE.CHIQ
RussianХИ2.ТЕСТ
SpanishPRUEBA.CHICUAD
SwedishCHI2.TEST
TurkishKİKARE.TEST