ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Math
  3. How to Run a Chi-Square Test in Excel With CHISQ.TEST

How to Run a Chi-Square Test in Excel With CHISQ.TEST

By ExcelReady Team·Updated November 3, 2026·7 min read

The short answer

To run a chi-square test in Excel, put your observed counts in a table, build a second table of expected counts (row total × column total ÷ grand total), then use =CHISQ.TEST(observed, expected). It returns the p-value. A p-value below your cut-off, often 0.05, suggests the two categories are related. CHISQ.TEST needs Excel 2010 or later.

Key takeaways

  • A chi-square test of independence checks whether two categories, such as channel and purchase, are related.
  • Expected count = row total × column total ÷ grand total. Write it once with mixed references like $D2*B$5/$D$5 and fill it.
  • =CHISQ.TEST(observed, expected) returns the p-value, not the chi-square statistic.
  • Get the statistic with SUMPRODUCT((O-E)^2/E) and compare it with CHISQ.INV.RT(0.05, df).
  • Use counts, not percentages, and aim for expected counts of at least 5 in every cell.
On this page+
  1. What a chi-square test tells you
  2. Step 1: Count the observed data with COUNTIFS
  3. Step 2: Build the expected table with mixed references
  4. Step 3: Get the p-value with CHISQ.TEST
  5. Step 4: Calculate the chi-square statistic
  6. How to interpret the result honestly
  7. Common chi-square mistakes in Excel
  8. Practise it

A chi-square test in Excel takes four steps: count your data, build a table of expected counts, run =CHISQ.TEST(observed, expected), and read the p-value it returns. The test tells you whether two categories, such as marketing channel and "bought or not", look related or could just be chance. This guide is for analysts, students and anyone handling survey or campaign data who wants the formulas without a statistics package.

What a chi-square test tells you#

A chi-square test of independence compares the counts you observed with the counts you would expect if the two categories had nothing to do with each other. If the gap between them is large, the categories are probably related.

The example in this guide uses 300 customers who came from three channels. Each one either bought (Yes) or didn't (No). The question: does the purchase rate depend on the channel?

The test gives a p-value: the probability of seeing a gap at least this large if there were really no relationship. You compare it with a cut-off you choose before you look, usually 0.05.

  • p below 0.05: the data give evidence of a relationship at the 5% level.
  • p at or above 0.05: there isn't enough evidence of a relationship. That is not proof that there is none.

Step 1: Count the observed data with COUNTIFS#

Start with a table of counts, one row per channel and one column per outcome. If your raw data has one row per customer, with the channel in column A and Yes/No in column B of a sheet called Data, COUNTIFS builds the table for you. In B2:

Excel formula
=COUNTIFS(Data!$A$2:$A$301,$A2,Data!$B$2:$B$301,B$1)

Fill it across and down. $A2 always reads the channel name in column A, and B$1 always reads the outcome in row 1. The guide to COUNTIFS and SUMIFS and the COUNTIFS function guide explain the syntax, and a pivot table count gives the same numbers if you prefer clicking.

Add totals with SUM. The observed table looks like this:

ABCD
1ChannelYesNoTotal
2Email4060100
3Social2575100
4Search3565100
5Total100200300

Overall, 100 of 300 customers bought: one in three. Email converted 40%, Social 25% and Search 35%. The test checks whether those differences are bigger than chance would produce.

Step 2: Build the expected table with mixed references#

The expected count for each cell is what you'd see if every channel converted at the overall rate:

Expected = row total × column total ÷ grand total

For Email / Yes that is 100 × 100 ÷ 300 = 33.33. Put an "Expected" table below the first one, in rows 8 to 11, and type this in B9:

Excel formula
=$D2*B$5/$D$5

The dollar signs make the formula safe to fill across B9:C11:

  • $D2 locks the column, so it always reads a row total from column D, but the row changes as you fill down.
  • B$5 locks the row, so it always reads a column total from row 5, but the column changes as you fill right.
  • $D$5 locks both, so every cell divides by the grand total.

Press F4 (Mac: ⌘T) while the cursor is in a reference to cycle through the $ options. The guide to the dollar sign in Excel covers mixed references in detail. Every expected count here is 33.33 for Yes and 66.67 for No, because each channel has 100 customers.

Step 3: Get the p-value with CHISQ.TEST#

CHISQ.TEST takes the observed range and the expected range, in that order:

Excel formula
=CHISQ.TEST(B2:C4,B9:C11)

The result is about 0.072. Don't include the totals row or column: the ranges must hold only the counts, and both must be the same size.

CHISQ.TEST works out the degrees of freedom (df) for you. For a table with more than one row and more than one column, df = (rows − 1) × (columns − 1). Here that is (3 − 1) × (2 − 1) = 2.

CHISQ.TEST needs Excel 2010 or later, including Microsoft 365 and Excel for Mac. Older files may use CHITEST, which gives the same answer. The Analysis ToolPak has no chi-square tool, so formulas are the standard way to do this in Excel.

Step 4: Calculate the chi-square statistic#

Many reports ask for the statistic as well as the p-value. It adds up (observed − expected)² ÷ expected for every cell:

Excel formula
=SUMPRODUCT((B2:C4-B9:C11)^2/B9:C11)

The result is 5.25. Compare it with the critical value for your cut-off and df:

Excel formula
=CHISQ.INV.RT(0.05,2)

That returns about 5.99. Since 5.25 is below 5.99, the result isn't significant at the 5% level, which matches the p-value of 0.072. You can also go the other way: =CHISQ.DIST.RT(5.25,2) returns the same p-value.

To see which cells drive the result, look at each cell's share of the 5.25:

ChannelYesNo
Email1.330.67
Social2.081.04
Search0.080.04

Social / Yes contributes most: Social converted fewer customers than expected (25 instead of 33.33).

How to interpret the result honestly#

A p-value of 0.072 means: if channel and purchase were unrelated, a gap at least this big would turn up about 7% of the time. At the 0.05 cut-off, that's not enough evidence to say the channels convert differently.

Keep these points in mind when you report it:

  • Not significant doesn't mean "no difference". With 100 customers per channel, a real but modest difference can easily miss the cut-off. More data might change the result.
  • Significant doesn't mean "big" or "causes". A tiny p-value says a relationship probably exists, not how strong it is or why. Report the percentages next to it, as in the guide to percentage of total.
  • Pick the cut-off before you look. Changing from 0.05 to 0.10 after seeing 0.072 is not a fair test.

Common chi-square mistakes in Excel#

These are the slips that give wrong p-values:

  1. Using percentages instead of counts. The test needs raw counts. 40% of 100 and 40% of 10,000 are very different evidence.
  2. Including totals in the ranges. Use B2:C4, not B2:D5.
  3. Expected counts below 5. A common rule of thumb is that every expected count should be at least 5. If some are smaller, combine categories or collect more data.
  4. Counting people twice. Each person or item must be in exactly one cell. Survey questions where people can tick several answers break this rule; see how to analyse survey results for counting each answer.
  5. Forgetting the dollar signs. Without $D2*B$5/$D$5, the expected formula points at the wrong totals once you fill it.
  6. Comparing with other software on a 2×2 table. Excel's CHISQ.TEST doesn't apply a continuity correction. Some statistics tools apply one by default for 2×2 tables, so their p-value can be slightly larger.

Practise it#

The statistics part is two formulas. The skills that make it work are counting with conditions and locking references. Practise COUNTIFS and SUMIFS in a live spreadsheet to build count tables quickly, then practise relative and absolute references so formulas like $D2*B$5/$D$5 fill correctly the first time. Try the exercise on this page to check the expected-count formula now.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Calculate the expected count for Email / Yes: row total × column total ÷ grand total. Click B8 and type a formula with mixed references so it could be filled across the table, then press Enter.

fx
ABCDE
1
Channel
Yes
No
Total
2
Email
40
60
100
3
Social
25
75
100
4
Search
35
65
100
5
Total
100
200
300
6
7
Expected
Yes
8
Email
9
10
11

Tip: Lock the column of the row total ($D2), the row of the column total (B$5) and both parts of the grand total ($D$5).

Practise this in a lesson

LessonCOUNTIFS and SUMIFSCount and sum with several conditions at once, and learn why SUMIFS puts the sum range first.LessonRelative vs absolute references ($)Lock a cell with $ so it doesn't move when you copy a formula, one of the most-tested Excel skills.Function guideCOUNTIFSCount rows that meet several conditions with COUNTIFS. Examples for text, number ranges and between-values, plus a live exercise.

Frequently asked questions

What does CHISQ.TEST return in Excel?

+

CHISQ.TEST returns the p-value of the test, a number between 0 and 1. It does not return the chi-square statistic itself. A small p-value, such as below 0.05, means the observed counts are unlikely if the two categories were unrelated.

How do I calculate expected values for a chi-square test in Excel?

+

For each cell, multiply its row total by its column total and divide by the grand total. With row totals in column D, column totals in row 5 and the grand total in D5, the formula =$D2*B$5/$D$5 can be filled across the whole table.

How do I get the chi-square statistic in Excel?

+

Use =SUMPRODUCT((observed-expected)^2/expected) with your two ranges. You can also convert the p-value back with =CHISQ.INV.RT(p, df), where df is (rows - 1) × (columns - 1).

What is the difference between CHISQ.TEST and CHITEST?

+

They give the same result. CHISQ.TEST is the current name, added in Excel 2010. CHITEST is the older name, kept so old workbooks still work.

Can I use percentages in a chi-square test?

+

No. The test needs raw counts, such as 40 people. Percentages hide the sample size, so the p-value would be wrong. Count with COUNTIFS or a pivot table first.

Sources

  • COUNTIFS function - Microsoft Support
  • SUMPRODUCT function - Microsoft Support
  • Switch between relative, absolute, and mixed references - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What a chi-square test tells you
  2. Step 1: Count the observed data with COUNTIFS
  3. Step 2: Build the expected table with mixed references
  4. Step 3: Get the p-value with CHISQ.TEST
  5. Step 4: Calculate the chi-square statistic
  6. How to interpret the result honestly
  7. Common chi-square mistakes in Excel
  8. Practise it

Keep reading

Conditional math· 7 min read

COUNTIFS and SUMIFS: Multiple Conditions in Excel

COUNTIFS counts rows that meet several conditions, and SUMIFS adds numbers from those rows. Each condition is a pair: a range, then its criteria. A row counts only if it matches every pair. SUMIFS puts the sum range first: =SUMIFS(E2:E9,A2:A9,"North",C2:C9,"Laptop") totals North laptop revenue.

Projects· 6 min read

How to Analyse Survey Results in Excel

To analyze survey data in Excel, keep one row per response and one column per question. Count each answer with COUNTIF, such as =COUNTIF(C2:C11,5), and divide by the number of responses for a percentage. COUNTIFS compares groups, like ratings of 4 or more in Sales, and a pivot table summarises every answer by group without formulas.

Math· 6 min read

Absolute References and the $ Sign in Excel

An Excel absolute reference uses dollar signs, like $F$1, to lock a cell so it doesn't change when you copy or fill a formula. Use it for a value every row shares, such as a tax rate: =B2*(1+$F$1). Press F4 while editing to add the $ signs. $F1 locks only the column; F$1 locks only the row.

More on math

  • How to Calculate Churn Rate in Excel, Monthly and Yearly
  • Compound Interest Formula in Excel, Step by Step
  • How to Calculate a Confidence Interval in Excel
  • How to Convert Units in Excel With the CONVERT Function
  • Find the Correlation Between Two Columns in Excel
  • How to Calculate Cost per Unit in Excel
All math articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free