Tabellab
Data, tech, science & health

One-way ANOVA in Excel: the F test and p-value, step by step

A one-way ANOVA in Excel tests whether the means of three or more groups are all equal. You split the total variation into the part between the group means and the part within the groups, divide each by its degrees of freedom and compare the two with an F ratio: F = MS between ÷ MS within. =F.DIST.RT(F, df between, df within) turns it into a p-value. In the example, four pastry displays tested in 24 stores give F = 4.95 with 3 and 20 degrees of freedom and a p-value of 0.0099, so at least one display sells differently. The display explains 42.6% of the variation in sales (eta squared), and every number comes from a formula you can rebuild.

Updated 21 Oct 2026 6 min read By Tabellab team

What a one-way ANOVA tests

The null hypothesis H₀ says that all group means are equal: the display a store uses makes no difference to how many pastries it sells. The alternative is that at least one mean differs. "One-way" means there is one factor (the display) with several levels (A, B, C and D), and each store belongs to exactly one group.

Why not run t-tests on every pair? Four groups give six pairs, and with six tests at the 5% level the chance of at least one false alarm is about 1 − 0.95⁶ = 26%. ANOVA asks one question about all groups at once and keeps the error rate at 5%.

Worked example: four pastry displays in 24 stores

Rows 2 to 7 are pastries sold per day, six stores per display. Rows 9 to 11 summarise each group, rows 14 to 17 are the ANOVA table and rows 19 to 24 the test. The data are fictional.

Worked example: four pastry displays in 24 stores
ABCDE
1StoreDisplay ADisplay BDisplay CDisplay D
2Store 142504045
3Store 236434539
4Store 347543548
5Store 440464243
6Store 545524641
7Store 638483847
8
9Group mean41.3348.8341.0043.83
10Variance (VAR.S)17.4716.1717.6012.17
11Within SS (DEVSQ)87.3380.8388.0060.83
12
13Grand mean43.75
14SourceSSdfMSF
15Between groups235.50378.504.95
16Within groups317.002015.85
17Total552.5023
18
19p-value (F.DIST.RT)0.0099
20Critical F at 5% (F.INV.RT)3.10
21Eta squared (SSB ÷ SST)42.6%
22Omega squared (less biased)33.1%
23Check: SSB + SSW − SST0.00
24Decision at 5%Reject H0
Key formulas
  • B11=DEVSQ(B2:B7)Within-group sum of squares
  • B15=COUNT(B2:B7)*DEVSQ(B9:E9)Between-group SS (equal group sizes)
  • E15=D15/D16F ratio = MS between ÷ MS within
  • E19=F.DIST.RT(E15,C15,C16)Right-tail p-value
  • E21=B15/B17Eta squared

The p-value of 0.00988 is shown rounded to four decimals. The ToolPak's Anova: Single Factor gives the same table.

Step 1: group means and the grand mean

Put each group in its own column, as in the example, or keep the data in long format with one row per store and a group label, and use AVERAGEIF. The group means are 41.33, 48.83, 41.00 and 43.83 pastries a day, and the grand mean of all 24 stores is 43.75. Display B looks better, but the stores within each group also differ by a lot, from 43 to 54 for display B alone. ANOVA asks whether the gap between the means is large compared with that noise.

Step 2: sums of squares with DEVSQ

DEVSQ returns the sum of squared deviations from the mean, which is exactly what ANOVA needs:

  • SS within: =DEVSQ(B2:B7) for each group, added up: 317.0. This is the noise inside the groups.
  • SS between: the squared distance of each group mean from the grand mean, weighted by the group size. With six stores per group, =COUNT(B2:B7)*DEVSQ(B9:E9) = 235.5. With groups of different sizes use =SUMPRODUCT(n,(means-grand mean)^2) instead.
  • SS total: =DEVSQ(B2:E7) over all 24 stores = 552.5.

SS between + SS within must equal SS total. The check row in the sheet makes sure no store was left out of a range.

Step 3: degrees of freedom, mean squares, F and the p-value

The degrees of freedom are k − 1 = 3 between the groups and N − k = 24 − 4 = 20 within them. Dividing each sum of squares by its degrees of freedom gives the mean squares: MS between = 235.5 ÷ 3 = 78.5 and MS within = 317 ÷ 20 = 15.85. If H₀ were true, both would estimate the same noise and F would be close to 1. Here F = 78.5 ÷ 15.85 = 4.95.

The p-value is the right tail of the F distribution: =F.DIST.RT(4.95,3,20) = 0.0099. It is below 0.05, so you reject H₀. The same decision with the critical value: =F.INV.RT(0.05,3,20) = 3.10, and 4.95 is above it. Report it as F(3, 20) = 4.95, p = 0.010.

The Data Analysis ToolPak shortcut

Excel also has a ready-made one-way ANOVA: enable the Analysis ToolPak (File, Options, Add-ins), then choose Data, Data Analysis, Anova: Single Factor, select the four columns and set alpha to 0.05. It prints the same table, with the SS, df, MS, F, p-value and F crit columns, and the numbers match the formulas above.

The difference is that the ToolPak writes static values. Change one store and the table is out of date, while the formula version updates at once and shows how every number is built. Use the formulas for a model you will reuse, and the ToolPak to check them.

Effect size, assumptions and the next step

A p-value says whether the means differ, not by how much. Eta squared = SS between ÷ SS total = 42.6% of the variation in sales is explained by the display. With small groups eta squared overstates the effect, so many reports use omega squared, (SSB − df between × MS within) ÷ (SST + MS within) = 33.1%, which is still a large effect.

ANOVA assumes independent observations, roughly normal data in each group and similar variances. The group variances here run from 12.17 to 17.60, a ratio of about 1.45, which is well inside the common rule of thumb of 4 (Levene's test is the formal check). For clearly skewed data or ordinal ratings, a rank-based test is safer, the same idea as the Mann-Whitney U test for two groups.

A significant F does not say which displays differ. That is the job of a post-hoc test such as Tukey's HSD, which compares every pair while keeping the overall error rate at 5%.

Common mistakes

  • Running many t-tests instead. Six pairwise tests at 5% have about a 26% chance of at least one false positive. Run the ANOVA first and a post-hoc test after it.
  • Using the left tail. F.DIST(F,df1,df2,TRUE) returns the left tail. The ANOVA p-value is F.DIST.RT, or 1 minus the cumulative value.
  • Swapping the degrees of freedom. The first df belongs to the numerator (between groups, k − 1), the second to the denominator (within groups, N − k). Swapped, the p-value is wrong.
  • The equal-size shortcut with unequal groups. n × DEVSQ(means) only works when every group has the same size. Otherwise weight each squared deviation by its own group size.
  • Reading "significant" as "large". With large samples a tiny difference becomes significant. Report eta or omega squared with the p-value.
  • Stopping at the F test. A significant F only says that some means differ. Use Tukey's HSD or Bonferroni-adjusted tests to find which pairs.

Frequently asked questions

How do I do a one-way ANOVA in Excel?

Either use the Data Analysis ToolPak (Anova: Single Factor) or build it with formulas: group means, sums of squares with DEVSQ, degrees of freedom, mean squares, F = MS between ÷ MS within and the p-value with F.DIST.RT. Both give the same table.

How do you interpret the p-value of an ANOVA?

It is the probability of an F ratio at least this large if all group means were equal. Below your significance level, usually 0.05, you conclude that at least one group mean differs. It does not tell you which group or how large the difference is.

What is the difference between one-way and two-way ANOVA?

A one-way ANOVA has one factor, such as the display. A two-way ANOVA has two factors, such as display and price, and can also test whether they interact, for example whether a display only works at the lower price.

What if the group variances are not equal?

ANOVA is fairly robust when groups have the same size and the largest variance is less than about four times the smallest. With very unequal variances, especially with unequal group sizes, use Welch's ANOVA, and for skewed data a rank-based test such as Kruskal-Wallis.

Practise it in a lab

Related guides

Reading is step one. Doing is step two.

Every guide links to a lab where you build the same calculation in an online spreadsheet and get instant feedback.

Open the lab