Install free

Guides

Two-way ANOVA in Google Sheets

A two-way ANOVA tests two factors at once, for example fertilizer type and watering level, and with repeated measurements also tests whether the factors interact. Excel's ToolPak has two versions and StatPak has both.

Your dataTool
Several measurements for each combination of the two factorsAnova: Two-Factor With Replication
Exactly one measurement for each combinationAnova: Two-Factor Without Replication

With replication

Eighteen plots: three fertilizers (columns) crossed with two watering levels (row blocks), three plots per combination. Yield in kg per plot.

ABCD
1Fertilizer AFertilizer BFertilizer C
2Low water424844
3455043
4404746
5High water506452
6536655
7496351

The layout matters. The first row holds the column factor's labels. The first column holds each row-factor label once, on the first row of its block. Every block must have the same number of rows.

  1. Open Extensions, StatPak, Data Analysis and choose Anova: Two-Factor With Replication.
  2. Input range: A1:D7, including the label row and label column.
  3. Rows per sample: 3. Leave Alpha at 0.05 and click Run.
Anova: Two-Factor With Replication
SUMMARYFertilizer AFertilizer BFertilizer CTotal
Low water
Count3339
Sum127145133405
Average42.3333348.3333344.3333345
Variance6.3333332.3333332.3333339.75
High water
Count3339
Sum152193158503
Average50.6666764.3333352.6666755.88889
Variance4.3333332.3333334.33333343.61111
Total
Count666
Sum279338291
Average46.556.3333348.5
Variance25.178.6666723.5
ANOVA
Source of VariationSSdfMSFP-valueF crit
Sample533.55561533.5556145.51524.5619E-84.747225
Columns324.11112162.055644.196972.9164E-63.885294
Interaction58.77778229.388898.0151520.0061563133.885294
Within44123.666667
Total960.444417

Reading the result

The ANOVA table has three tests, one per row. Each compares its F with F crit, or equivalently its P-value with 0.05.

When the interaction is significant, describe the effects combination by combination (for example with the cell averages in the summary) instead of quoting a single "fertilizer effect".

Without replication

Units sold of three product tiers in four regions, one figure per region and tier.

ABCD
1BasicPlusPro
2North1209560
3South13510271
4East1108852
5West14211075

Choose Anova: Two-Factor Without Replication, select A1:D5, tick Labels in first row and column and click Run.

Anova: Two-Factor Without Replication
SUMMARYCountSumAverageVariance
North327591.66667908.3333
South3308102.66671024.333
East325083.33333857.3333
West33271091123
Basic4507126.75208.9167
Plus439598.7588.91667
Pro425864.5109.6667
ANOVA
Source of VariationSSdfMSFP-valueF crit
Rows1172.6673390.888947.063550.00014588664.757063
Columns7776.16723888.083468.13042.5819E-75.143253
Error49.8333368.305556
Total8998.66711

Rows (regions) has P-value 0.0001458866 and Columns (tiers) has P-value 2.5819E-7, so both region and tier matter. With one value per cell there is no way to separate interaction from random error, so this version has no Interaction row. It assumes the two factors do not interact.

Without an add-on

Google Sheets has no ANOVA function. For the version without replication you can build the table yourself: SS Rows is c * DEVSQ of the row averages, SS Columns is r * DEVSQ of the column averages, SS Total is =DEVSQ(B2:D5), and SS Error is what remains. Each P-value is =F.DIST.RT(F, df, df_error). The version with replication needs cell, row and column averages for every block, which is where the tool saves real time.

Related guides