Calculate CHI-SQUARE in Excel

Chi-Square measures how far observed values differ from expected values. It tells you whether the difference is real or just a random chance.

In Excel, you can calculate the Chi-Square value in three steps using the CHISQ.TEST function.

CHISQ.TEST calculates the p-value (probability value) for a Chi-Square test.

CHISQ.TEST Syntax

CHISQ.TEST(actual_range,expected_range)

It takes two arguments:

  • actual_range – the range with your observed values.
  • expected_range – the range with the values you’d expect if there were no relationship.

Example: Calculating Chi-Square Value in Excel

Let’s say you ran a survey to check if men and women prefer different drinks and collected this data:

GenderLemonadeMilkshakeTotal
Men401050
Women302050
Total7030100

You want to know if drink preference depends on gender.

Step 1: Enter the Observed Values in Excel

Enter the observed values in cell range B2:C3.

Observed values to calculate chi-square value

Step 2: Calculate Expected Values

Calculate the expected values using this formula:

Expected Value = Row Total x Column Total / Grand Total

Calculate these for each gender in cell range G2:H3.

Formula to calculate expected values to calculate chi-square value

In this example, we’re testing whether two variables (gender and drink preference) are independent.

So the expected values are calculated from the observed totals using a formula.

The idea is, if there is no relation between the drink and the gender, of the 70 people surveyed for lemonade, 35 men and 35 women would prefer lemonade, and out of the 30 people who preferred milkshake, 15 men and 15 women would prefer milkshake.

In other cases, you might already have expected values from past data or a known benchmark (for example, “last year 60% chose Lemonade and 40% chose Milkshake”). In that situation, you’d skip Step 2 and directly use your existing expected values in the CHISQ.TEST function.

Step 3: Calculate the Chi-Square

Use the CHISQ.TEST function:

=CHISQ.TEST(B2:C3,G2:H3)
CHISQ.TEST formula

The above formula returns 0.0290963.

Since this is less than 0.05, the result is statistically significant, which means the drink preference is related to gender.

If the value had been 0.05 or higher, the result wouldn’t be significant, meaning drink preference has nothing to do with gender.

Statistically significant
p = 0.029 < 0.05
Drink preference depends on gender
Men
Lemonade
40
exp: 35
Milkshake
10
exp: 15
Women
Lemonade
30
exp: 35
Milkshake
20
exp: 15
Observed Expected

So this is how you can use an inbuilt function in Excel to calculate chi-square value.

I hope you found this article helpful.

Other Excel articles you may also like:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.

Leave a Comment