Tabellab

Group Means & the Grand Mean: Setting Up a One-Factor Experiment

Lesson 1 of 20Lab

All lessons
  1. Group Means & the Grand Mean: Setting Up a One-Factor ExperimentLabFree
  2. Sums of Squares: SSB, SSW and SST with DEVSQLab Locked
  3. The One-Way ANOVA Table: df, Mean Squares, F and the p-ValueLab Locked
  4. Effect Size: Eta Squared, Omega Squared and Cohen's fLab Locked
  5. Checking the Assumptions: Variance Ratio, Residuals & Levene's TestLab Locked
  6. Post-Hoc Tests: Tukey HSD and Bonferroni-Adjusted t-TestsLab Locked
  7. Two-Way ANOVA without Replication: The Randomised Block DesignLab Locked
  8. Factorial Experiments: Main Effects, Interaction & the Interaction PlotLab Locked
  9. Unequal Group Sizes: One-Way ANOVA When Stores Drop OutLab Locked
  10. Welch's ANOVA: Comparing Means When the Spreads DifferLab Locked
  11. Confidence Intervals for Group Means and Differences with the Pooled MS WithinLab Locked
  12. Planned Contrasts: Testing the Question You Actually AskedLab Locked
  13. Scheffé's Method: Safe Comparisons Chosen After Seeing the DataLab Locked
  14. Trend Analysis: Linear and Curved Effects of an Ordered FactorLab Locked
  15. Simple Effects: Where Exactly Does the Bonus Work?Lab Locked
  16. Latin Square Design: Removing Store and Week Effects at OnceLab Locked
  17. ANCOVA: Adjusting Group Means for a Pre-Test CovariateLab Locked
  18. Random Effects: Variance Components and the Intraclass CorrelationLab Locked
  19. When the Spread Grows with the Mean: Log Transform Before ANOVALab Locked
  20. Final Project: Experiment Readout Dashboard for the Cold-Brew LaunchLab Locked

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — $9.90
Loading the spreadsheet…

Why a fair experiment starts with four averages

Every week someone in a business says "let's try it and see". A new shelf layout, a different email subject line, a cheaper supplier, a new menu board. Then the numbers come in, one version looks a little better, and the meeting decides on the strength of a gap that may be nothing more than luck. The tool that separates a real difference from ordinary noise is the analysis of variance, ANOVA for short, and it begins with something every Excel user already knows: averages.

This free first lesson of ANOVA & Experimental Design in Excel is for analysts, operations and marketing people, students in a statistics or research-methods course, and anyone who has to judge a test with more than two versions. You do not need any statistics software. Everything is done with ordinary worksheet functions, so you can see every number and explain it to a manager who has never heard of an F test.

In the lab above you work with Marlowe Coffee Co., a fictional coffee chain. Marlowe wants to know whether the way pastries are displayed changes how many are sold. Twenty-four stores were randomly given one of four displays for four weeks: the Classic tray, a Tiered stand, a Lit case and a Counter-front basket. The result for each store is the average number of pastries sold per day. Before any test can be run, you need the four group means, the grand mean and the distance between them. That is exactly what this lesson builds.

The core idea: factor, levels, response and the grand mean

An experiment has a factor, the thing you deliberately change. Here the factor is the display. The versions of the factor are its levels or groups: four displays, so four levels. The number you measure on every unit is the response: pastries sold per day. Each store is one experimental unit.

Three design ideas make the comparison fair. Randomisation means a random draw, not the regional manager, decides which store gets which display, so busy city-centre stores are not all handed the shiny new case. Replication means each display is tried in several stores, here six, so that one unusual store cannot decide the result. Blocking groups similar units together and compares displays within each group; you meet it in the randomised block lab later in the course. When every group has the same number of units, as here, the design is called balanced.

The grand mean is the average of all 24 stores, regardless of display. It is the best guess for a store if the display made no difference at all. Each group mean minus the grand mean is that display's estimated effect: a positive number means the display sells more than the average store, a negative number means it sells less. ANOVA then asks one question: are these effects larger than the store-to-store variation would produce by chance if all four displays were really equal?

In a balanced design the grand mean is also the simple average of the four group means. If those two numbers disagree in your sheet, either the design is not balanced or one of your AVERAGEIF ranges is wrong. It is a free check worth doing every time.

Worked example: the Marlowe display trial

The lab data come in long format: one row per store, with the store code in column A, the display label in column B and pastries per day in column C. This is the shape a database export or a form normally produces, and it is the shape ANOVA formulas in Excel handle most easily. Sorted by display, the 24 results look like this:

DisplayStores (n)Pastries per day (the six stores)MeanMean − grand mean
Classic6S01 42, S06 51, S10 45, S15 53, S17 44, S23 4747.0-5.0
Tiered6S03 56, S05 47, S11 58, S14 52, S20 55, S21 5053.0+1.0
Lit case6S02 54, S08 60, S09 65, S16 55, S19 53, S22 6158.0+6.0
Counter-front6S04 56, S07 48, S12 46, S13 51, S18 54, S24 4550.0-2.0
All stores24total 1,24852.0 (grand mean)0.0

The Lit case leads with 58 pastries a day, the Classic tray trails with 47, and the Tiered and Counter-front displays sit in between. The grand mean is 1,248 / 24 = 52.0, and because each display has six stores it equals (47 + 53 + 58 + 50) / 4 as well. The deviations, −5, +1, +6 and −2, add up to zero, which is always true when each is weighted by its group size.

Pastries per day by display (24 stores)404448525660646847Classic53Tiered58Lit case50Counter-front- - grand mean 52— group mean
Each dot is one store, the black bar is the display mean, the dashed line is the grand mean of 52. The groups overlap a lot, which is why we need ANOVA rather than eyeballing the means.

The strip chart tells a more honest story than a bar chart alone. The Lit case stores are mostly above the dashed line and the Classic stores are mostly below it, but the clouds of dots overlap: the best Classic store (S15, 53) sold as many pastries as the weakest Lit case store (S19, 53) and more than three of the Tiered stores. Inside every display the best and worst store are 11 or 12 pastries a day apart. The question for the rest of the course is whether a spread of 11 between the best and worst display mean is big compared with that noise.

These are the formulas the lab expects. The ranges are locked with $ so the formula can be copied down the summary table without the data range sliding:

CellWhat it holdsFormulaResult
B28Stores with the Classic display=COUNTIF($B$2:$B$25,A28)6
C28Mean pastries, Classic=AVERAGEIF($B$2:$B$25,A28,$C$2:$C$25)47.0
C30Mean pastries, Lit case (copied down)=AVERAGEIF($B$2:$B$25,A30,$C$2:$C$25)58.0
B33Grand mean of all 24 stores=AVERAGE(C2:C25)52.0
D28Deviation of Classic=C28-$B$33−5.0
D30Deviation of Lit case=C30-$B$33+6.0
(check)Deviations weighted by n must add to zero=SUMPRODUCT(B28:B31,D28:D31)0

Group mean − grand mean (pastries per day)−8−40+4+8−5Classic+1Tiered+6Lit case−2Counter-front
The four estimated display effects: group mean minus the grand mean. Bars above zero beat the average store, bars below fall short.

Seen as deviations, the result becomes a set of effects that sum to zero. This is the language ANOVA uses. The model behind it says that every store's result equals the grand mean, plus the effect of its display, plus a residual that captures everything else about that store: its location, its staff, the weather on its street. Store S09, a Lit case store that sold 65 pastries, splits like this:

Store S09 (Lit case): 65 = 52 + 6 + 7grand mean 52+6+7same for every storedisplay(store noise)residualeffect010203040506070pastries per day
The one-way ANOVA model for a single store: grand mean + display effect + residual. Summing the squared effects and squared residuals over all stores gives the sums of squares in lab 2.

The display effect is the same for all six Lit case stores. The residual is different for each store and averages to zero within a group. Lesson 2 squares and adds these pieces: the squared display effects give the variation between displays, the squared residuals give the variation within displays. Everything ANOVA does later, the F ratio, the p-value, the effect sizes, comes from comparing those two totals.

How to do it in Excel, step by step

  1. Check the data. Click any cell in the table and press Ctrl+A to see the block Excel recognises. Make sure every row has a display label, the labels are spelled consistently (a trailing space turns "Classic " into a fifth group) and the response is a number, not text.
  2. Build the summary table. In A28:A31 type the four display names, or in Excel 365 enter =UNIQUE(B2:B25) in A28 and let it spill. Add headers for stores, mean and deviation in row 27.
  3. Count the units. In B28 enter =COUNTIF($B$2:$B$25,A28). Press F4 while the cursor is in a range to add the dollar signs. Select B28:B31 and press Ctrl+D to fill down. Every display should show 6.
  4. Compute the group means. In C28 enter =AVERAGEIF($B$2:$B$25,A28,$C$2:$C$25) and fill down to C31. The first argument is where the labels are, the second is the label to match, the third is what to average.
  5. Compute the grand mean. In B33 enter =AVERAGE(C2:C25). Cross-check it with =AVERAGE(C28:C31), which gives the same 52.0 because the design is balanced.
  6. Compute the deviations. In D28 enter =C28-$B$33 and fill down. Lock B33 with F4, otherwise the copied formulas point at the empty cells below it.
  7. Chart the means. Select A27:A31, hold Ctrl and select C27:C31, then choose Insert › Charts › Clustered Column (or press Alt+F1). Use the + Chart Elements button to add an axis title such as "Pastries per day", and give the chart a title that states the question.
  8. Optional: a strip chart. Give each display a number 1 to 4 in a helper column with =MATCH(B2,$A$28:$A$31,0), then insert Insert › Charts › Scatter with that number on the x-axis and pastries on the y-axis. You see every store, not just the averages.
Excel's Analysis ToolPak (File › Options › Add-ins › Manage: Excel Add-ins › Go, tick Analysis ToolPak) has an "Anova: Single Factor" tool under Data › Data Analysis. It expects one column per group, not long format, and it writes static numbers rather than formulas. This course builds every part with formulas instead, so the table updates when data change and you understand each number the tool would print.

Designing the experiment before you open Excel

Good analysis cannot rescue a poor design, so a few minutes of planning pay off. Write down the response before the trial starts and measure it the same way in every unit: here, average pastries per day over the same four weeks. Decide the levels in advance. Choose units that are as similar as possible, and if they are not, think about blocking by region or store size.

For a fair random assignment in Excel, list the 24 stores, add a column with =RAND(), copy it and paste as values so it stops changing, sort by that column and give the first six stores the Classic display, the next six the Tiered stand, and so on. In Excel 365, =SORTBY(A2:A25,RANDARRAY(24)) does the shuffle in one formula. Keep the file: being able to show how the assignment was made is part of a credible result.

Finally, keep the groups the same size if you can. A balanced design makes the arithmetic simpler, makes the test less sensitive to unequal variances, and makes the grand-mean check above work. Six stores per display is a small trial. It is enough to learn the method, and the course later shows how effect size helps you judge whether a bigger trial would be worth running.

Course cover: ANOVA and experimental design in Excel
ANOVA & Experimental Design in Excel: 20 labs that take one coffee-chain experiment from group means to a full factorial analysis.

Common mistakes and how to spot them

  • Unlocked ranges. If the mean for Counter-front looks odd and the formula in C31 reads AVERAGEIF(B5:B28,…), the ranges slid when you copied. Lock them with F4 and copy again.
  • Averaging the whole column. =AVERAGE(C2:C25) in every row gives 52 four times. A summary table where all group means are identical is the signal.
  • Inconsistent labels. "Lit case", "Lit Case" and "Lit case " look alike. AVERAGEIF is not case-sensitive, but a trailing space makes a different label, so a group shows n = 5 and a phantom group appears. Check that the counts add up to 24.
  • Deviation the wrong way round. Grand mean minus group mean flips every sign, so the best display shows a negative effect. The convention is group mean minus grand mean.
  • Using the median. The median is robust, but ANOVA is built on means and squared deviations. Use AVERAGE and AVERAGEIF throughout.
  • Reading a winner off the bar chart. A gap of 11 pastries looks decisive on a column chart that starts at zero and even more so on one that starts at 40. Only the comparison with within-group noise, from lesson 2 on, says whether it is real.
  • Forgetting the design. If the stores chose their own display, the "effect" could simply be that keen managers picked the new case. No formula fixes that, which is why randomisation comes first.

Quick reference: Excel functions and shortcuts in this lesson

Function or shortcutWhat it doesExample in this lesson
AVERAGEIF(range, criteria, average_range)Mean of the values whose label matches the criteria=AVERAGEIF($B$2:$B$25,A28,$C$2:$C$25)
COUNTIF(range, criteria)Counts rows with a given label=COUNTIF($B$2:$B$25,A28)
AVERAGE(range)Arithmetic mean of all values=AVERAGE(C2:C25)
SUMPRODUCT(a, b)Multiplies two ranges and adds the productsCheck that the weighted deviations sum to 0
STDEV.S(range)Sample standard deviationSpread inside one display (with FILTER or a helper column)
UNIQUE(range) (Excel 365)Lists each group label once=UNIQUE(B2:B25)
RAND() / RANDARRAY(n)Random numbers for a fair assignmentSort stores by a random column before assigning displays
F4Cycles a reference through $A$1, A$1, $A1, A1Lock $B$2:$B$25 before copying down
Ctrl+DFills the top cell of a selection downCopy C28 to C29:C31
Alt+F1Inserts a default chart of the selectionQuick column chart of the means

Real-world uses

  • Retail and hospitality. Compare shelf layouts, menu boards, opening hours or staff training programmes across stores, with stores as the units.
  • Digital marketing. Compare three or four email subject lines, landing pages or ad creatives on conversion rate or revenue per visitor, when an A/B test grows into an A/B/C/D test.
  • Manufacturing and quality. Compare the output or defect rate of several machines, shifts, suppliers or settings of a process parameter.
  • Agriculture and science. Compare fertiliser types, feeds or treatments on plots or animals, the classic setting where the method was first developed.
  • HR and education. Compare test scores after different training formats, or productivity across teams that adopted different tools, keeping in mind that people are rarely randomised.

What you will build in the rest of this course

This first lesson is free. The labs that follow are part of the full course, a one-time purchase of $9.90, and they turn these four means into a complete analysis of the Marlowe trial and two further experiments.

Sums of Squares: SSB, SSW and SST with DEVSQ. You split the total variation of pastry sales into a between-display part and a within-display part with DEVSQ, and see that the two always add up to the total.

The One-Way ANOVA Table: df, Mean Squares, F and the p-Value. You complete the classic ANOVA table, degrees of freedom, mean squares and the F ratio, and decide with F.DIST.RT and F.INV.RT whether the displays really differ.

Effect Size: Eta Squared, Omega Squared and Cohen's f. You go beyond the yes/no of a p-value and measure how much of the variation the display explains with eta squared, omega squared and Cohen's f.

Checking the Assumptions: Variance Ratio, Residuals & Levene's Test. You check whether ANOVA's assumptions hold: compare the group variances, compute the residuals and run Levene's test with ordinary formulas.

Post-Hoc Tests: Tukey HSD and Bonferroni-Adjusted t-Tests. Once you know the displays differ, you find out which pairs differ with Tukey's honestly significant difference and compare it with Bonferroni-adjusted t-tests.

Two-Way ANOVA without Replication: The Randomised Block Design. You test three menu boards in a randomised block design, remove the store-to-store differences and see how blocking sharpens the test.

Factorial Experiments: Main Effects, Interaction & the Interaction Plot. You analyse a 2 × 3 price × placement experiment: cell means, main effects, the interaction F test and an interaction plot that shows when one factor changes the effect of the other.

Summary

A one-factor experiment compares several versions of one thing on a measured response. Randomise the units, replicate each level and, where possible, keep the groups the same size. In Excel, COUNTIF and AVERAGEIF on long-format data give the group sizes and means, AVERAGE gives the grand mean, and group mean minus grand mean gives each level's effect. For Marlowe, the Lit case runs six pastries a day above the grand mean of 52 and the Classic tray five below it. Whether that is a real difference depends on the store-to-store noise, and measuring that noise is where ANOVA proper begins.

Now scroll up to the lab and build it yourself: the four means with AVERAGEIF, the grand mean, the deviations and a column chart. The coach checks each step and explains what went wrong if a number does not match.

Frequently asked questions

What is the grand mean in ANOVA?

The grand mean is the average of all observations in the experiment, regardless of group. In a balanced design, where every group has the same size, it also equals the average of the group means.

How do I calculate group means in Excel?

With data in long format, use AVERAGEIF(label range, group label, value range), for example =AVERAGEIF($B$2:$B$25,A28,$C$2:$C$25), and copy it down for each group. A PivotTable with the group in Rows and the value summarised as Average gives the same result.

What is the difference between a factor and a level?

The factor is the variable you deliberately change in the experiment, such as the type of display. The levels are its versions, such as Classic, Tiered, Lit case and Counter-front.

Why do I need ANOVA instead of comparing the averages?

Group means always differ a little just by chance. ANOVA compares the differences between the means with the variation inside the groups and tells you whether the gaps are larger than noise would produce.

Why should an experiment be randomised?

Random assignment makes it unlikely that the groups differ systematically before the trial starts, for example that the busiest stores all receive the same display. Without it, an apparent effect may come from how the units were chosen.

Can Excel do a one-way ANOVA?

Yes. The Analysis ToolPak has an Anova: Single Factor tool, and you can also build the whole ANOVA table with formulas such as DEVSQ, F.DIST.RT and F.INV.RT, which is what this course does so the results update automatically.

Keep going: ANOVA & Experimental Design in Excel: One-Way, Two-Way & Post-Hoc Tests

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.

  1. Sums of Squares: SSB, SSW and SST with DEVSQ
  2. The One-Way ANOVA Table: df, Mean Squares, F and the p-Value
  3. Effect Size: Eta Squared, Omega Squared and Cohen's f
  4. Checking the Assumptions: Variance Ratio, Residuals & Levene's Test
  5. Post-Hoc Tests: Tukey HSD and Bonferroni-Adjusted t-Tests
  6. Two-Way ANOVA without Replication: The Randomised Block Design
  7. Factorial Experiments: Main Effects, Interaction & the Interaction Plot
  8. Unequal Group Sizes: One-Way ANOVA When Stores Drop Out
  9. Welch's ANOVA: Comparing Means When the Spreads Differ
  10. Confidence Intervals for Group Means and Differences with the Pooled MS Within
  11. Planned Contrasts: Testing the Question You Actually Asked
  12. Scheffé's Method: Safe Comparisons Chosen After Seeing the Data
  13. Trend Analysis: Linear and Curved Effects of an Ordered Factor
  14. Simple Effects: Where Exactly Does the Bonus Work?
  15. Latin Square Design: Removing Store and Week Effects at Once
  16. ANCOVA: Adjusting Group Means for a Pre-Test Covariate
  17. Random Effects: Variance Components and the Intraclass Correlation
  18. When the Spread Grows with the Mean: Log Transform Before ANOVA
  19. Final Project: Experiment Readout Dashboard for the Cold-Brew Launch

Buy course — $9.90 See the full course