Home › Sheets Formulas
ALL UNITS · REFERENCE

💻 The Google Sheets Formula Guide

Every formula we use this semester, in the order we meet it, explained piece by piece — with the answer you should see.

How to use this page

This page collects every Google Sheets formula from PSY 315 in one place. It runs in course order: Unit 1 first, Unit 15 last. Each formula gets a card that tells you what it does, how to type it, what each piece inside the parentheses means, a real example from our SJNY Student Life dataset with the number Sheets should give you, and the mistakes that trip people up.

Open the dataset in another tab, choose File ▸ Make a copy so you can type in it, and type along. Reading a formula is not the same as typing one. If your answer matches the card, you did it right. If it does not, the "Watch out" note on that card usually tells you why.

Quick finder

Know the formula you need? Jump straight to it. The last column tells you the unit where we first meet it, so you can go back to that unit page for the full story behind the statistic.

Every Google Sheets formula in PSY 315, what it gives you, and the unit where it first appears
FormulaWhat it gives youFirst met
AVERAGEThe meanUnit 1
SUMAdds a range (Σx)Unit 1
COUNTn, how many numbersUnit 1
COUNTIFHow many cells match one labelUnit 1
SQRTSquare rootUnit 1
COUNTIF ÷ NFrequency and relative frequency tablesUnit 2
COUNTIFSCounts rows that pass two or more rules (bins)Unit 2
MEDIANThe middle scoreUnit 3
MODE, MODE.MULTThe most common score(s)Unit 3
MAX, MINHighest, lowest, and the rangeUnit 4
VAR / VAR.SSample varianceUnit 4
STDEV / STDEV.SSample standard deviationUnit 4
STANDARDIZEA z-scoreUnit 5
NORM.S.DISTArea below a z (percentile)Unit 5
NORM.DISTArea below a raw score; above; betweenUnit 5
NORM.S.INVThe z for a percentile (backwards)Unit 5
CORRELPearson's rUnit 6
CORREL + FILTERr inside one group onlyUnit 6 / Review 2
SLOPE, INTERCEPTb and a of the regression lineUnit 7
RSQr², proportion of variance explainedUnit 7
FORECAST.LINEARA predicted Y (Ŷ) and residualsUnit 7
STDEV/SQRT(COUNT)Standard error of the meanUnit 8
RANDBETWEENA random whole numberUnit 8
Multiply, then SUMAND / OR probabilityUnit 8
The z-test buildSE, z, two-tailed pUnit 9
ABSDrops the minus signUnit 9
IFWrites your decision for youUnit 9
One-sample t by handt and Cohen's dUnit 10
T.DIST.2TTwo-tailed p for a tUnit 10
T.INV.2TCritical tUnit 10
FILTERPulls out one group's scoresUnit 11
T.TESTp for any t-test, directlyUnits 10–13
Difference columnAfter − before, filled downUnit 12
AVERAGEIFThe mean of one groupUnit 13
F.INV.RTCritical FUnit 13
$ absolute referenceBonferroni follow-ups that copy cleanlyUnit 13
AVERAGEIFSThe mean of one cell (two labels)Unit 14
CHISQ.TESTp for a chi-square testUnit 15
CHISQ.INV.RT, CHISQ.DIST.RTCritical χ², and p from a χ²Unit 15

Sheets basics: read this once

Every formula on this page follows the same few rules. Learn them now and the rest of the semester gets much easier, because almost every error you will hit comes from breaking one of them.

The anatomy of a formula

Here is the first formula of the course, taken apart:

=AVERAGE(F2:F201)
PieceWhat it isWhy it matters
=The equals signIt tells Sheets "calculate this." Without it, Sheets just shows the words AVERAGE(F2:F201) as text.
AVERAGEThe function nameThe job you want done. Capitals are optional; Sheets fixes them for you. Spelling is not optional: =AVERGE gives #NAME?.
( )ParenthesesEverything the function needs goes inside. Every ( needs its own ).
F2:F201A range"Column F, from row 2 down to row 201." The colon means through.

When a function needs more than one piece of information, the pieces are called arguments and they are separated by commas. For example, =CORREL(H2:H201, L2:L201) has two arguments, and =T.TEST(V2:V201, U2:U201, 2, 1) has four. When you start typing a function name, Sheets pops up a little help box that lists the arguments in order and bolds the one you are on. Watch that box. It is the fastest way to catch an argument in the wrong slot.

Why every range is 2:201

Row 1 of the dataset holds the column names (sleep_hours, stress, and so on). The 200 students sit in rows 2 through 201. So a full column of data is always row 2 to row 201. If you stop at row 200, you silently lose the last student and your answer is a hair off. Two habits fix this: always type 2:201, and when your answer is close but not exact, check the range first.

Text labels go in quote marks

When a formula has to match a word, such as a class year or a diet, the word goes inside straight double quotes: "Senior", "Vegan", "Animal Photos". Type the label exactly as it appears in the column, including spaces. A typo does not give an error message; it gives 0, because Sheets found zero cells spelled your way. The column map below lists every label in the dataset so you can copy them exactly.

Smart-quote trap: if you copy a formula out of a Word document, an email, or a slide, the quote marks often turn curly (“like this”). Sheets does not accept curly quotes and shows #ERROR! (formula parse error). Delete the quotes and retype them in Sheets.

Order of operations: brackets first

Sheets does math in the usual order: brackets, then powers (^), then multiply and divide, then add and subtract. This matters constantly in this course, because many statistics have the shape "something minus something, divided by something." Compare:

=(AVERAGE(J2:J201)-18)/(6/SQRT(200))   → 4.91     ✓ subtract first, then divide
=AVERAGE(J2:J201)-18/(6/SQRT(200))     → −22.34   ✗ Sheets divides 18 first

When in doubt, add brackets. Extra brackets never hurt; missing ones produce confident nonsense.

Cell references, copying, and the fill handle

Instead of typing a number, you can point at the cell that holds it. If cell AF1 holds your mean and AF2 holds your standard error, then =(AF1-18)/AF2 uses them. This is how we build tests one row at a time.

When you copy a formula to a new cell, Sheets shifts its references by the same amount. Copy =AF2/200 one row down and it becomes =AF3/200. That is usually what you want. To copy a formula down a whole column, click the cell, then double-click the small blue square at its bottom-right corner (the fill handle). Sheets fills down to the last row of data.

Sometimes you want a reference that does not move, such as one cutoff value that every row must compare against. Put dollar signs in it: $AF$6 is an absolute reference, and it stays $AF$6 wherever you paste it. Click inside the reference and press F4 (on a Mac, fn + F4) to add the dollar signs, or type them. You will use this in Unit 13.

Reading what Sheets hands back

Error messages, decoded

You seeWhat it meansUsual fix
#NAME?Sheets does not recognize a word in your formula.Check the function's spelling, and put text labels in quote marks.
#ERROR!Formula parse error: Sheets cannot read the formula at all.Look for a missing ), a missing comma, or curly quotes.
#DIV/0!You divided by zero or by an empty cell.Check the cell your formula divides by.
#VALUE!The function got the wrong type of input, such as a word where it needs a number.Check that your range points at a number column.
#N/ASomething was not found. With FILTER, no row matched your label.Check the label's spelling against the column.
An answer of 0Often a label typo in COUNTIF or AVERAGEIF.Copy the label from the column map.
The formula shows as wordsThe = is missing, or the cell is formatted as plain text.Start with =; set Format ▸ Number ▸ Automatic.

One last trap: fractions turn into dates

Type 3/10 into an empty cell and Sheets decides you mean March 10. Always type a fraction as a formula, =3/10, or as a decimal, 0.3. This bites hardest in the probability problems in Unit 8.

Column map: the SJNY Student Life dataset

Most formulas on this page point at a column of the class dataset. Keep this map open; it saves a lot of scrolling. N = 200 students, one row per student, data in rows 2 to 201.

ColVariableTypeExact labels (for quote marks)
Astudent_idIDS001 … S200
BgenderNominal"Woman", "Man", "Non-binary"
Cclass_yearOrdinal"Freshman", "Sophomore", "Junior", "Senior"
DcommuterNominal"Commuter", "Resident"
Ejob_hoursRatio—
Fsleep_hoursRatio—
Gstudy_hours_weekRatio—
Hsocial_media_hoursRatio—
Iexercise_hours_weekRatio—
JstressInterval (scale score)—
KgpaInterval—
LlonelinessInterval (scale score)—
MwellbeingInterval (scale score)—
Nself_compassionInterval (scale score)—
Opay_conditionNominal"$1", "$20"
Ptask_enjoymentInterval—
Qprocessing_levelOrdinal"Shallow", "Medium", "Deep"
Rwords_recalledRatio—
Sthreat_conditionNominal"Threat", "Control"
Tmath_scoreInterval—
Umood_preInterval—
Vmood_postInterval—
Wcommute_minutesRatio—
XdietNominal"Omnivore", "Vegetarian", "Vegan"
Yanimal_compassionInterval (scale score)—
ZmasculinityInterval (scale score)—
AAmeat_commitmentInterval (scale score)—
ABmenu_conditionNominal"Standard", "Animal Photos"
ACplant_based_choiceRatio—

The dataset file also has a Vegan Study (US-UK) tab that we use in Unit 14, and an ANOVA Calculator tab for Unit 13. In the Vegan Study tab the data start in row 5 (rows 1–4 hold a title, a note, a blank row, and the column names), so its ranges run 5:204.

When a card says "type this in AF2," any empty cell to the right of the data works. We use columns AE and beyond in class so our work never sits on top of the data.

Block 1 · Describe the data (Units 1–5)

Block 1 is about summarizing one variable at a time: how many, where the center is, how spread out, and where one score sits relative to everyone else. The formulas here are the foundation for everything after. You will still be typing AVERAGE and STDEV in December.

Unit 1 · Intro & Variables

Unit 1's big lesson is that the scale of measurement decides which math is legal. That lesson shows up immediately in Sheets: AVERAGE and SUM only make sense on quantitative columns, while categorical columns get COUNTIF. Unit 1 page →

UNIT 1 · USED ALL SEMESTER

=AVERAGE(range) — the mean

What it does. Adds up every number in the range and divides by how many numbers there are. That is the mean, x̄ = Σx ÷ n, done in one step.

The one argument. range is the column of numbers you want the mean of.

=AVERAGE(F2:F201)    → 6.815   the mean of sleep_hours (about 6.82 hours)

How to read it. The average SJNY student in our dataset sleeps about 6.82 hours a night. Click any cell in the column to compare a single student to that value.

Watch out. Point AVERAGE at a categorical column like gender (column B) and Sheets returns #DIV/0!, because there are no numbers in it to average. Point it at a column of codes (1 = Freshman, 2 = Sophomore…) and Sheets will happily give you a "mean class year" that means nothing. The function cannot tell whether a mean makes sense. You can.

UNIT 1

=SUM(range) — add it all up (Σx)

What it does. Adds every number in the range. Σ (capital sigma) in a formula means "add them all up," and SUM is Σ in Sheets.

=SUM(G2:G201)        → 2399.2  total study hours per week across all 200 students

Where you will use it again. SUM becomes your check total. In Unit 2 you add up a frequency table and make sure it reaches 200, and in Unit 15 you check that observed and expected counts both total N. If a check total is off, a label is misspelled somewhere.

UNIT 1 · USED ALL SEMESTER

=COUNT(range) — n, how many numbers

What it does. Counts the cells in the range that hold numbers. It skips blanks and words.

=COUNT(F2:F201)      → 200     n for sleep_hours

Why it matters. n appears in almost every formula in this course: the mean, the standard error, degrees of freedom. Typing COUNT(…) instead of the number 200 means your formula still works on a smaller sample, such as the first 30 students in Unit 8.

Watch out. COUNT ignores text, so =COUNT(C2:C201) on the class-year column returns 0. To count words, use COUNTIF.

UNIT 1 · USED ALL SEMESTER

=COUNTIF(range, "label") — count one category

What it does. Looks down a column and counts the cells that match your label. This is the right tool for a nominal or ordinal column.

ArgumentMeaningExample
rangeWhere to lookC2:C201 (class_year)
"label"What to count, in quote marks"Senior"
=COUNTIF(C2:C201, "Senior")     → 39    Seniors in the dataset
=COUNTIF(D2:D201, "Commuter")   → 151   commuter students

Watch out. The label must match what is in the cells. The commuter column holds "Commuter" and "Resident", so =COUNTIF(D2:D201, "Yes") returns 0. Copy labels from the column map.

UNIT 1

=SQRT(number) — square root

What it does. Undoes squaring. 4² = 16, so √16 = 4.

=SQRT(16)            → 4

Where you will use it again. Everywhere. The standard deviation is the square root of the variance (Unit 4), and the standard error divides by √n (Units 8–12). You will usually see SQRT wrapped around another function, as in SQRT(COUNT(J2:J201)). Sheets works from the inside out: it counts first, then takes the root.

Unit 2 · Frequency Distributions

A frequency distribution answers "how many students fall in each category or each range of scores?" Sheets builds one with COUNTIF for categories and COUNTIFS for score bins. Unit 2 page →

UNIT 2

A frequency table: COUNTIF + SUM + divide by N

What it does. One COUNTIF per category gives the frequency (f). Dividing each by N gives the relative frequency (the proportion). SUM checks that nothing was missed.

CellTypeShows
AE2 · AF2Freshman · =COUNTIF(C2:C201, "Freshman")56
AE3 · AF3Sophomore · =COUNTIF(C2:C201, "Sophomore")51
AE4 · AF4Junior · =COUNTIF(C2:C201, "Junior")54
AE5 · AF5Senior · =COUNTIF(C2:C201, "Senior")39
AE6 · AF6Total · =SUM(AF2:AF5)200
AG2=AF2/200, then fill down to AG50.28, 0.255, 0.27, 0.195
AG6=SUM(AG2:AG5)1

How to read it. 28% of the class are Freshmen. Click the % button on column AG to show the proportions as percentages. The relative frequencies must add to 1 (100%); the frequencies must add to N.

Watch out. If the total is not 200, a label is misspelled and one COUNTIF came back 0 or short. That is exactly why you build the check row.

UNIT 2

=COUNTIFS(range, rule, range, rule) — count score bins

What it does. Counts the rows that pass every rule you give it. Notice the S at the end: COUNTIF takes one rule, COUNTIFS takes as many pairs as you like. For a grouped frequency table of a number column, you give it two rules on the same column: "at least the bottom of the bin" and "below the top of the bin."

=COUNTIFS(W2:W201, ">=0",  W2:W201, "<15")   → 63   commutes of 0 up to (not including) 15 min
=COUNTIFS(W2:W201, ">=15", W2:W201, "<30")   → 78   15 up to 30
=COUNTIFS(W2:W201, ">=30", W2:W201, "<45")   → 42   30 up to 45
=COUNTIFS(W2:W201, ">=45")                   → 17   45 and up
PieceMeaning
W2:W201 (first)Check this column…
">=15"…keep rows that are 15 or more
W2:W201 (second)Check the same column again…
"<30"…and keep only rows below 30

Watch out. Use >= on the bottom and < on the top so a score of exactly 15 lands in one bin, not two. The four bins above add to 63 + 78 + 42 + 17 = 200: no student lost, none counted twice. The comparison rules go in quote marks just like labels.

Unit 3 · Central Tendency

Three ways to describe the "typical" score. In Sheets they are three short formulas that take the same range, which makes comparing them easy. Unit 3 page →

UNIT 3

=AVERAGE, =MEDIAN — mean versus middle

What MEDIAN does. Sorts the scores and returns the middle one. With an even n such as 200, it averages the two middle scores.

=AVERAGE(J2:J201)    → 20.085   mean stress
=MEDIAN(J2:J201)     → 19       middle stress score

=AVERAGE(W2:W201)    → 22.845   mean commute (minutes)
=MEDIAN(W2:W201)     → 20.5     middle commute

How to read it. When the mean sits above the median, a few large scores are pulling the mean up: the distribution is positively skewed. Commute time is the classic case. A handful of students travel more than an hour, which drags the mean 2 minutes above the median. For skewed data, report the median.

UNIT 3

=MODE(range) and =MODE.MULT(range) — most common score

What they do. MODE returns the score that appears most often. MODE.MULT returns every score tied for most often.

=MODE(J2:J201)       → 18          the most common stress score
=MODE(F2:F201)       → 6.9         …but sleep has a tie!
=MODE.MULT(F2:F201)  → 6.9, 6.7    both modes, one per cell

Why both exist. When two scores tie, plain MODE quietly reports only the first one it meets and says nothing about the tie. MODE.MULT lists every mode and spills them into the cells below, one per cell. Leave those cells empty, or you get a #REF! error saying the result has no room.

Watch out. The mode is the only one of the three that works on nominal data, but MODE only accepts numbers. For the most common category, compare COUNTIF results instead.

Unit 4 · Variability

Center is half the story; spread is the other half. Unit 4 gives you the range, the variance, and the standard deviation, which is the single most-used number in the rest of the course. Unit 4 page →

UNIT 4

=MAX(range)-MIN(range) — the range

What it does. MAX finds the highest score, MIN the lowest, and subtracting gives the range: the distance from the bottom score to the top score.

=MAX(J2:J201)                → 38
=MIN(J2:J201)                → 4
=MAX(J2:J201)-MIN(J2:J201)   → 34    the range of stress

Also useful for spotting impossible values. If =MIN(F2:F201) came back negative, someone typed a sleep time that cannot exist. In Review 2 you use MIN and MAX on masculinity (column Z) to see that its scores run from 1.1 to 6.5, so a prediction at 0 would go outside the data.

Watch out. The range uses only two scores, so one extreme student can blow it up. That weakness is why we need the standard deviation.

UNIT 4

=VAR(range) — sample variance (same as VAR.S)

What it does. Finds each score's distance from the mean, squares those distances, adds them up (SS), and divides by n − 1. That is the average squared distance from the mean, s².

=VAR(J2:J201)        → 34.86   variance of stress (in squared stress points)
=VAR.S(J2:J201)      → 34.86   identical; the .S stands for "sample"

How to read it. The variance is in squared units, which nobody can picture. That is why we almost always take its square root next.

UNIT 4 · USED ALL SEMESTER

=STDEV(range) — sample standard deviation (same as STDEV.S)

What it does. Returns the square root of the sample variance: the typical distance of a score from the mean, back in the original units.

=STDEV(J2:J201)      → 5.90    SD of stress
=STDEV.S(J2:J201)    → 5.90    identical
=SQRT(AG2)           → 5.90    if AG2 holds the variance: proof that SD = √variance

How to read it. The typical student's stress sits about 6 points above or below the mean of 20.09.

Watch out: P versus S. Sheets also offers STDEVP, STDEV.P, VARP, and VAR.P. The P versions divide by N and treat your data as the entire population. Our 200 students are a sample, so always use plain STDEV/VAR or the .S versions, which divide by n − 1. On stress the wrong one gives 5.89 instead of 5.90: small here, but enough to cost you on an exam that checks to two decimals.

Unit 5 · z-Scores & the Normal Curve

Unit 5 turns a raw score into a z-score and a z-score into a percentile. Sheets replaces the paper z-table entirely. For many more worked problems, see the Area Under the Curve, Step by Step page. Unit 5 page →

Every example in this unit uses stress (column J): mean = 20.09, SD = 5.90, from =AVERAGE(J2:J201) and =STDEV(J2:J201).

UNIT 5

=STANDARDIZE(x, mean, SD) — a z-score

What it does. Computes z = (x − mean) ÷ SD: how many standard deviations a score sits above (+) or below (−) the mean.

ArgumentMeaningExample
xThe raw score32
meanThe group's mean20.09
SDThe group's standard deviation5.90
=STANDARDIZE(32, 20.09, 5.90)    → 2.02    a stress score of 32 is 2.02 SDs above the mean
=(32-20.09)/5.90                 → 2.02    the same thing typed by hand

Watch out. The order is score, mean, SD. Swap the score and the mean and you get −2.02, the right size with the wrong side of the curve.

UNIT 5

=NORM.S.DIST(z, TRUE) — the area below a z

What it does. Returns the proportion of a normal curve that sits below your z. That proportion is the percentile. The S means standard normal: a curve with mean 0 and SD 1, the curve that z-scores live on.

ArgumentMeaning
zThe z-score (a number, or a cell that holds one)
TRUE"Cumulative": give me all the area to the left. Always type TRUE in this course.
=NORM.S.DIST(2.02, TRUE)                          → 0.9783   97.83% score below z = 2.02
=NORM.S.DIST(1, TRUE)                             → 0.8413   z = 1 is about the 84th percentile
=1-NORM.S.DIST(2.02, TRUE)                        → 0.0217   area ABOVE z = 2.02
=NORM.S.DIST(2.02, TRUE)-NORM.S.DIST(1.00, TRUE)  → 0.1370   area BETWEEN z = 1.00 and 2.02

Watch out. FALSE instead of TRUE returns the height of the curve at that point, which is not an area and not a percentile. If you get something like 0.05 for a z of 2, check that last argument.

UNIT 5 · EXAM FAVORITE

=NORM.DIST(x, mean, SD, TRUE) — area from a raw score

What it does. The same area as NORM.S.DIST, but it takes the raw score, mean, and SD and skips the z step. No S, because the curve is your normal curve, not the standard one.

Three questions, three patterns. Learn the patterns and you can answer any area question:

The question asks for…Type thisStress example → answer
Below a score=NORM.DIST(x, mean, SD, TRUE)=NORM.DIST(32, 20.09, 5.90, TRUE) → 0.9782
Above a score=1-NORM.DIST(x, mean, SD, TRUE)=1-NORM.DIST(32, 20.09, 5.90, TRUE) → 0.0218
Between two scores=NORM.DIST(high,…)-NORM.DIST(low,…)=NORM.DIST(32, 20.09, 5.90, TRUE)-NORM.DIST(26, 20.09, 5.90, TRUE) → 0.1365
How many peoplearea × N=0.1365*200 → 27.3, about 27 students

Why "above" is 1 minus. The whole curve is 1 (100%). NORM.DIST only ever gives the part on the left, so everything else, the part on the right, is 1 minus that.

Why "between" is a subtraction. The area below 32 includes everything below 26 too. Subtract the area below 26 and only the slice from 26 to 32 is left. This works whether the two scores are on the same side of the mean or straddle it. Put the high score first; reversed, you get a negative answer.

Why 0.1365 and not 0.1370? The NORM.S.DIST version above used z-scores rounded to two decimals. Both are correct; the raw-score version is slightly more exact.

Watch out. Sketch the curve and shade the area before you type. If both scores are on the same side of the mean, the answer has to be under 50%. The sketch catches most mistakes before Sheets ever sees them.

UNIT 5

=NORM.S.INV(proportion) — percentile to z (backwards)

What it does. Runs NORM.S.DIST in reverse. You give it an area below; it gives you the z that cuts off that area.

=NORM.S.INV(0.95)    → 1.645   the z that marks the top 5% (95% are below it)
=NORM.S.INV(0.975)   → 1.96    the z that marks the top 2.5%

Where you will use it again. 1.96 is the famous two-tailed cutoff for α = .05 in Unit 9. Now you know where it comes from: 2.5% in each tail leaves 97.5% below.

Block 2 · Relationships (Units 6–7)

Block 2 moves from one variable to two. The formulas now take two ranges, and for regression the order of those ranges matters. That single fact causes more lost points in Block 2 than anything else, so each card below tells you which range goes first.

Unit 6 · Correlation (Pearson r)

Unit 6 page →

UNIT 6

=CORREL(range1, range2) — Pearson's r

What it does. Returns the correlation between two columns: a number from −1 to +1 that tells you the direction (sign) and strength (size) of the straight-line relationship.

ArgumentMeaning
range1One variable's scores
range2The other variable's scores, for the same 200 students, same rows
=CORREL(H2:H201, L2:L201)    →  0.52   social media hours × loneliness
=CORREL(H2:H201, M2:M201)    → −0.46   social media hours × wellbeing

How to read it. r = .52 is a positive, strong correlation: students who spend more time on social media tend to report more loneliness. r = −.46 is negative and moderate-to-strong: more social media goes with lower wellbeing. Neither tells you that one causes the other.

Order does not matter here. =CORREL(L2:L201, H2:H201) gives the same .52. Correlation is symmetric. (Regression, next unit, is not.)

Squaring r. To get the proportion of variance the two variables share, square it: =CORREL(H2:H201, L2:L201)^2 → 0.27, or 27%. The ^ means "to the power of." RSQ in Unit 7 does the same job in one step.

Watch out. Both ranges must start and end on the same rows. =CORREL(H2:H201, L3:L202) pairs each student's social media with the next student's loneliness and gives a meaningless number with no error message. Always make a scatterplot (Insert ▸ Chart ▸ Scatter) too: r only measures straight lines.

UNIT 6 · REVIEW 2

=CORREL(FILTER(…), FILTER(…)) — r inside one group

What it does. FILTER pulls out only the rows that match a label (full card in Unit 11). Wrapping two FILTERs inside CORREL gives the correlation for one group only, such as men only.

=CORREL(FILTER(Z2:Z201, B2:B201="Man"), FILTER(AA2:AA201, B2:B201="Man"))       → 0.34
=CORREL(FILTER(Z2:Z201, B2:B201="Woman"), FILTER(AA2:AA201, B2:B201="Woman"))   → 0.21

How to read it. The link between masculinity (Z) and meat commitment (AA) is stronger among men (r = .34) than among women (r = .21).

Watch out. Both FILTERs must use the same rule, so they keep the same students in the same order. If one says "Man" and the other says "Woman," Sheets returns an error because the two lists have different lengths.

Unit 7 · Linear Regression

Regression draws the best-fit line Ŷ = a + bX and uses it to predict. Every regression function in Sheets wants the ranges in the same order: Y first, then X. Say it out loud as you type: "outcome, then predictor." Unit 7 page →

Running example: predict wellbeing (Y, column M) from social media hours (X, column H).

UNIT 7

=SLOPE(Y, X) and =INTERCEPT(Y, X) — b and a

What they do. SLOPE returns b, how much Ŷ changes for each 1-unit increase in X. INTERCEPT returns a, the predicted Y when X = 0.

=SLOPE(M2:M201, H2:H201)        → −1.43    b
=INTERCEPT(M2:M201, H2:H201)    → 28.80    a

How to read it. The line is Ŷ = 28.80 − 1.43X. Each extra hour of social media predicts wellbeing 1.43 points lower. A student with 0 hours is predicted to score 28.80.

Watch out: reversed ranges. =SLOPE(H2:H201, M2:M201) does not give an error. It gives a different slope, the one for predicting social media from wellbeing. In a Review 2 practice problem, =SLOPE(Z2:Z201, AA2:AA201) gives 0.26 instead of the correct 0.48 because the ranges are backwards. Y first, always.

UNIT 7

=RSQ(Y, X) — r², variance explained

What it does. Returns r², the proportion of the variability in Y that the line accounts for.

=RSQ(M2:M201, H2:H201)          → 0.22     22% of the variance in wellbeing
=RSQ(M2:M201, H2:H201)*100      → 21.56    the same, as a percentage number

How to read it. Social media hours account for about 22% of the differences in wellbeing among our students. The other 78% comes from everything else: sleep, friends, money, exams.

Watch out. RSQ is not the slope and not the correlation. It is always between 0 and 1 and is never negative, even when the relationship is negative (−.46² = .22).

UNIT 7 · EXAM FAVORITE

=FORECAST.LINEAR(x, Y, X) — a predicted score (Ŷ)

What it does. Plugs a new X into the regression line and returns the predicted Y. It saves you from computing a + bX by hand.

ArgumentMeaningExample
xThe X value you want a prediction for6 (hours)
YThe outcome columnM2:M201
XThe predictor columnH2:H201
=FORECAST.LINEAR(6, M2:M201, H2:H201)    → 20.19   predicted wellbeing at 6 hours
=FORECAST.LINEAR(3, M2:M201, H2:H201)    → 24.50   predicted wellbeing at 3 hours
=28.80 + (-1.43)*6                       → 20.22   by hand from a and b (rounding)

Residuals. A residual is how far a real student landed from the line: actual minus predicted. The first student (row 2) uses 4.4 hours and scored 27:

=M2-FORECAST.LINEAR(H2, M2:M201, H2:H201)   → 4.51   this student is 4.51 points happier than predicted

Same answer, older names. =FORECAST(6, M2:M201, H2:H201) and =TREND(M2:M201, H2:H201, 6) also return 20.19. FORECAST is the old name for FORECAST.LINEAR. TREND puts the new X last. Pick FORECAST.LINEAR and stick with it.

Watch out. Predict only inside the range of your X data. If social media hours run from about 0 to 10, a prediction at 25 hours is a guess the data cannot support.

Block 3 · Testing ideas (Units 8–12)

Block 3 is where description becomes inference. The new formulas compute a standard error, turn a test statistic into a p-value, and make a decision. You will notice the same pattern repeating: (what you got − what the null predicts) ÷ standard error. Once you can type that, every test is a variation.

Unit 8 · Probability & the Central Limit Theorem

Unit 8 page →

UNIT 8 · USED ALL OF BLOCK 3

=STDEV(range)/SQRT(COUNT(range)) — the standard error

What it does. Computes the standard error of the mean, SE = s ÷ √n: how much a sample mean typically wobbles from sample to sample just by chance. Three functions you already know, nested together.

PieceWhat Sheets doesStress result
COUNT(J2:J201)Finds n (innermost, so it goes first)200
SQRT(…)Square root of n14.14
STDEV(J2:J201)The sample SD5.90
/Divides SD by √n0.42
=STDEV(J2:J201)/SQRT(COUNT(J2:J201))    → 0.42   SE of stress, n = 200
=STDEV(J2:J31)/SQRT(COUNT(J2:J31))      → 1.25   SE of stress, first 30 students only

How to read it. Smaller samples wobble more. With 30 students, the mean stress score would typically miss the true mean by about 1.25 points. With 200, only about 0.42. That is the law of large numbers in one comparison.

Watch out. SE is not SD. The SD (5.90) describes how much individual students differ. The SE (0.42) describes how much sample means differ. Count your parentheses: there are three ( and three ).

UNIT 8

=RANDBETWEEN(low, high) — simulate chance

What it does. Returns a random whole number from low to high, inclusive. It re-rolls every time the sheet recalculates, which is any time you edit any cell.

=RANDBETWEEN(1,6)        → one die roll
=RANDBETWEEN(0,1)        → one coin flip (0 = tails, 1 = heads)
=AVERAGE(RANDBETWEEN(1,6), RANDBETWEEN(1,6), RANDBETWEEN(1,6), RANDBETWEEN(1,6))
                         → the mean of 4 dice: one sample mean

Watching the Central Limit Theorem. Fill that last formula down 500 rows and make a histogram of the column. Single dice rolls are flat (every face equally likely), but the means of 4 rolls pile up in a bell shape around 3.5. That is the CLT happening on your screen.

Watch out. Your numbers will not match a classmate's, and they change while you work. That is the point: it is chance. Report the pattern, not one roll.

UNIT 8

Probability in cells: multiply for AND, add for OR

What it does. No special function here, just arithmetic laid out so you can see the logic. Example: a slot machine has 3 reels, each lands on a star with probability .3 (a miss is .7). What is P(at least 2 stars)?

RowAK: WayAL · AM · AN: each reelAO: P(this way)
2Star, star, miss=3/10 · =3/10 · =7/10=AL2*AM2*AN2 → .063
3Star, miss, star=3/10 · =7/10 · =3/10fill down → .063
4Miss, star, star=7/10 · =3/10 · =3/10fill down → .063
5Star, star, star=3/10 · =3/10 · =3/10fill down → .027
6At least 2=SUM(AO2:AO5) → .216

How to read it. Multiplying across a row is the AND rule: reel 1 and reel 2 and reel 3. Adding down the column is the OR rule: way 1 or way 2 or way 3 or way 4. Adding is allowed because no two ways can happen on the same spin.

Watch out. Type =3/10 or 0.3. A bare 3/10 becomes March 10 and your probability becomes a date.

Unit 9 · Hypothesis Testing (the z-test)

Unit 9 builds a whole hypothesis test in 5 cells, one row at a time. Question: are SJNY students more stressed than the national norm of 18, if σ = 6? Unit 9 page →

UNIT 9

The 5-row z-test build

RowAE (label)AF (type this)ShowsWhat it is
1Sample mean=AVERAGE(J2:J201)20.085Our mean stress
2Standard error=6/SQRT(COUNT(J2:J201))0.42σ ÷ √n (σ is known: 6)
3z=(AF1-18)/AF24.91(mean − null) ÷ SE
4p=2*(1-NORM.S.DIST(ABS(AF3),TRUE))8.9E-07Two-tailed p
5Decision=IF(AF4<=0.05,"Reject H0","Fail to reject H0")Reject H0Sheets makes the call

Reading row 4 from the inside out. ABS(AF3) drops any minus sign. NORM.S.DIST(…, TRUE) gives the area below that z. 1 − … flips it to the area above: one tail. 2 * … counts both tails, because a two-tailed test asks about a difference in either direction.

How to read the result. p = 8.9E-07 = 0.00000089, far below .05. Reject H0: SJNY students are more stressed than the norm, z = 4.91, p < .001.

Your screen showsWhat went wrong
z ≈ 0.35You divided by σ (6), not by the standard error
z ≈ −22No brackets: =AF1-18/AF2. Subtract first: =(AF1-18)/AF2
p ≈ 4.5E-07You left off the 2*; that is one-tailed
"8.9E-07 is huge"It is scientific notation for a tiny number

Your turn. Copy AF1:AF5 to AI1. Change the column to F (sleep), σ to 1.4, and the null to 7. You should get mean 6.82, SE 0.10, z = −1.87, p = 0.062: fail to reject H0.

UNIT 9

=ABS(number) — absolute value

What it does. Drops the minus sign. =ABS(-16.48) → 16.48; =ABS(4.91) → 4.91.

Why we need it. In a two-tailed test, a z or t of −2 is exactly as extreme as +2. The tail-area formulas (NORM.S.DIST above, T.DIST.2T in Unit 10) expect a positive number, so we hand them ABS(…). In fact, T.DIST.2T returns #NUM! if you give it a negative t.

UNIT 9 · USED THROUGH UNIT 13

=IF(test, "if true", "if false") — the decision cell

What it does. Checks a condition. If the condition is true, it shows the first answer; if false, the second.

ArgumentMeaningExample
testA yes/no questionAF4<=0.05 (is p at or below α?)
"if true"What to show when the answer is yes"Reject H0"
"if false"What to show when the answer is no"Fail to reject H0"
=IF(AF4<=0.05, "Reject H0", "Fail to reject H0")    → Reject H0

Why bother? Because people misread p-values, especially in scientific notation. Once the IF cell is built, it reads the p correctly every time, and when you copy the build to a new problem it re-decides automatically.

Watch out. Point the test at the p-value cell, not the z cell. And the rule is "reject when p is less than .05," so the sign is <.

Unit 10 · One-Sample t-Test

Same question as Unit 9, one change: we no longer know σ, so we estimate it with the sample SD and use the t distribution. Question: do SJNY students sleep a different amount than the recommended 8 hours? Unit 10 page →

UNIT 10

The one-sample t build (and Cohen's d)

RowAE (label)AF (type this)Shows
1Mean=AVERAGE(F2:F201)6.815
2SD=STDEV(F2:F201)1.02
3n=COUNT(F2:F201)200
4t=(AVERAGE(F2:F201)-8)/(STDEV(F2:F201)/SQRT(COUNT(F2:F201)))−16.48
5p=T.DIST.2T(ABS(AF4), 199)4.7E-39
6Cohen's d=(AVERAGE(F2:F201)-8)/STDEV(F2:F201)−1.17
7Decision=IF(AF5<=0.05, "Reject H0", "Fail to reject H0")Reject H0

Row 4, piece by piece. The top, (AVERAGE(F2:F201)-8), is how far our mean is from the benchmark. The bottom, (STDEV(F2:F201)/SQRT(COUNT(F2:F201))), is the estimated standard error, built exactly like Unit 8's. Each half sits in its own brackets so Sheets subtracts before it divides. (Shorter version: =(AF1-8)/(AF2/SQRT(AF3)).)

Row 6, Cohen's d. Same top, but divide by the plain SD instead of the standard error. d tells you how big the difference is in SD units, which the p-value cannot. Here −1.17 is a large effect: our students sleep more than a full standard deviation below 8 hours.

Report it. t(199) = −16.48, p < .001, d = −1.17.

Watch out. =AVERAGE(F2:F201)-8/STDEV(…) with no brackets divides 8 first and gives nonsense.

UNIT 10

=T.DIST.2T(t, df) — p from a t

What it does. Returns the two-tailed p-value: the probability of a t at least this far from zero, in either direction, if the null were true. "2T" means two-tailed.

ArgumentMeaningExample
tYour t, made positive with ABSABS(AF4)
dfDegrees of freedom: n − 1 for a one-sample test199
=T.DIST.2T(ABS(AF4), 199)      → 4.7E-39
=T.DIST.2T(ABS(-16.48), 199)   → 4.7E-39   same, typing the t directly

Watch out. Without ABS, a negative t returns #NUM!. And df is n − 1 (199), not n (200).

UNIT 10

=T.INV.2T(α, df) — the critical t

What it does. Runs T.DIST.2T backwards: give it α and df, and it returns the cutoff where the rejection region begins. If |t| is bigger than this number, reject H0.

=T.INV.2T(0.05, 199)    → 1.97    critical t for n = 200
=T.INV.2T(0.05, 24)     → 2.06    critical t for n = 25

How to read it. Smaller samples need a bigger t to reach significance, because the t distribution has fatter tails when df is small. As df grows, the cutoff shrinks toward the z cutoff of 1.96.

UNIT 10 · SHORTCUT

=T.TEST(range, ARRAYFORMULA(range*0 + 8), 2, 1) — one-sample p in one cell

What it does. T.TEST (full card in Unit 11) compares two lists. For a one-sample test there is only one list, so we build the second: ARRAYFORMULA(F2:F201*0 + 8) turns every sleep score into 0 and adds 8, making a same-length column of 8s. A one-sample t is mathematically a paired test against a constant, so type 1 (paired) gives the right answer.

=T.TEST(F2:F201, ARRAYFORMULA(F2:F201*0 + 8), 2, 1)   → 4.7E-39   matches row 5 above

When to use it. To check your build. The long build gives you t and d, which you need to report; this shortcut gives only p.

Unit 11 · Independent-Samples t-Test

Now two separate groups. In our dataset both groups live in one column, so first we need a way to pull out one group at a time. That tool is FILTER. Question: did students who saw a menu with animal photos make more plant-based choices than students who saw the standard menu? Unit 11 page →

UNIT 11 · USED THROUGH UNIT 13

=FILTER(scores, labels="Group") — pull out one group

What it does. Returns only the scores whose row matches a label. On its own it spills a list of numbers down the column; wrapped inside another function, it hands that function just one group.

ArgumentMeaningExample
scoresThe numbers you wantAC2:AC201 (plant_based_choice)
labels="Group"Keep only rows where this column equals this labelAB2:AB201="Animal Photos"
=COUNTIF(AB2:AB201, "Animal Photos")                     → 97      n for group 1
=COUNTIF(AB2:AB201, "Standard")                          → 103     n for group 2
=AVERAGE(FILTER(AC2:AC201, AB2:AB201="Animal Photos"))   → 45.30   group 1 mean
=AVERAGE(FILTER(AC2:AC201, AB2:AB201="Standard"))        → 36.64   group 2 mean
=STDEV(FILTER(AC2:AC201, AB2:AB201="Animal Photos"))     → 11.30   group 1 SD

Watch out. Inside FILTER, the label test uses an equals sign, AB2:AB201="Standard", not a comma. (That is different from COUNTIF and AVERAGEIF, which use a comma.) The two ranges must be the same length. A misspelled label returns #N/A ("No matches are found in FILTER evaluation").

UNITS 10–13 · EXAM FAVORITE

=T.TEST(range1, range2, tails, type) — p for any t-test

What it does. Runs a t-test and returns the p-value directly. It does not return t. The last two arguments are numbers that tell Sheets which test to run, and they are where most mistakes happen.

ArgumentMeaningWhat we type
range1Group 1's scores (or the "after" scores)a range or a FILTER(…)
range2Group 2's scores (or the "before" scores)a range or a FILTER(…)
tails1 = one-tailed, 2 = two-tailed2, always, in this course
typeWhich t-testsee the next table
TypeTestUse it forUnit
1PairedSame people measured twice (before/after)12 (and the Unit 10 shortcut)
2Independent, equal variancesTwo separate groups of similar size and spread11
3Independent, unequal variances (Welch)Two separate groups with very different sizes or spreads13 follow-ups
=T.TEST(FILTER(AC2:AC201, AB2:AB201="Animal Photos"), FILTER(AC2:AC201, AB2:AB201="Standard"), 2, 2)
                                            → 2.0E-07   reject H0

How to read it. p = 0.0000002. Students shown the animal-photo menu made more plant-based choices (M = 45.30, SD = 11.30) than students shown the standard menu (M = 36.64, SD = 11.41), p < .001. Add an IF decision cell exactly as in Unit 9.

Watch out. The formula is long, so build it in pieces: type =T.TEST(, then the first FILTER(…), a comma, the second FILTER(…), then , 2, 2). Count your brackets. If you get a different p than a classmate, check the last argument first.

Unit 12 · Paired-Samples t-Test

Same students, measured twice: mood before (column U) and after (column V) a gratitude exercise. Unit 12 page →

UNIT 12

=T.TEST(after, before, 2, 1) — the paired test

RowAE (label)AF (type this)Shows
1Mood before=AVERAGE(U2:U201)5.355
2Mood after=AVERAGE(V2:V201)6.47
3Average rise=AF2-AF11.115
4p=T.TEST(V2:V201, U2:U201, 2, 1)5.8E-25
5Decision=IF(AF4<=0.05, "Reject H0", "Fail to reject H0")Reject H0

The type is 1. That final 1 tells Sheets the two columns are the same people, so it compares each student's after score with their own before score. Type 2 would treat them as 400 strangers and throw away the pairing.

Watch out. The two ranges must line up row by row: row 2 of U and row 2 of V must be the same student. They do in our dataset, because both columns cover rows 2 to 201.

UNIT 12

A difference column, filled down — and t by hand

What it does. A paired test is really a one-sample test on the differences. Building the difference column shows you that.

  1. Type Difference in AH1.
  2. In AH2, type =V2-U2 (after minus before for student 1).
  3. Click AH2, then double-click the small blue square at its bottom-right corner. Sheets fills the formula down to row 201, changing it to =V3-U3, =V4-U4, and so on.
  4. Check: =COUNT(AH2:AH201) should say 200.
=AVERAGE(AH2:AH201)                                   → 1.115   mean difference (same as row 3 above)
=AVERAGE(AH2:AH201)/(STDEV(AH2:AH201)/SQRT(200))      → 11.88   t, by hand

How to read it. The t formula is Unit 10's with a benchmark of 0: (mean difference − 0) ÷ standard error of the differences. Report: t(199) = 11.88, p < .001. Mood rose by about 1.1 points after the gratitude exercise.

Block 4 · Comparing many groups (Units 13–15)

Block 4 compares three or more groups (ANOVA) and two grouping factors at once (two-way ANOVA), then finishes with counts (chi-square). The workhorse formulas are AVERAGEIF and AVERAGEIFS, which find group means without any filtering by hand.

Unit 13 · One-Way ANOVA

Question: does animal compassion (column Y) differ by diet (column X: omnivore, vegetarian, vegan)? Unit 13 page →

UNIT 13 · USED IN UNIT 14

=AVERAGEIF(label range, "label", value range) — one group's mean

What it does. Averages only the values whose row carries a matching label. It is COUNTIF's sibling: same first two arguments, plus a third that says which numbers to average.

ArgumentSay it asExample
label rangeWhere to lookX2:X201 (diet)
"label"What to match"Vegan"
value rangeWhat to averageY2:Y201 (animal_compassion)
RowAEAF: meanAG: n
2Omnivore=AVERAGEIF(X2:X201, "Omnivore", Y2:Y201) → 3.91=COUNTIF(X2:X201, "Omnivore") → 136
3Vegetarian=AVERAGEIF(X2:X201, "Vegetarian", Y2:Y201) → 4.92=COUNTIF(X2:X201, "Vegetarian") → 46
4Vegan=AVERAGEIF(X2:X201, "Vegan", Y2:Y201) → 5.67=COUNTIF(X2:X201, "Vegan") → 18

How to read it. Animal compassion climbs from omnivores to vegetarians to vegans. Make a column chart of AF2:AF4 to see it. The ANOVA (next) asks whether those differences are bigger than chance.

Watch out. The order is where to look, what to match, what to average: label column first, number column last. Reverse them and you get #DIV/0!. A 0 or an error usually means a label typo.

Same answer with FILTER. =AVERAGE(FILTER(Y2:Y201, X2:X201="Vegan")) also returns 5.67. Use whichever you find easier to read; Review 4 uses both.

Each group's SD. Sheets has no STDEVIF, so use FILTER: =STDEV(FILTER(Y2:Y201, X2:X201="Vegan")) → 1.05 (omnivores 1.04, vegetarians 1.11). Every mean in an APA sentence needs its SD.

UNIT 13

Getting the F and the ANOVA table

Sheets has no single =ANOVA function. To get the full source table (SS, df, MS, F, p), use one of these:

  • The ANOVA Calculator tab in the class dataset file: put each group's scores into columns B, C, and D from row 6 down (any number of rows), and type each group's name in row 4. Fastest: in B6 type =FILTER('Raw Data'!Y2:Y201, 'Raw Data'!X2:X201="Omnivore"), then the same in C6 and D6 with the other 2 labels. The tab gives F, p, η², each group's SD, an APA line, and the 3 Bonferroni follow-ups. Our diet data give F(2, 197) = 32.19, p < .001, η² = .25.
  • The One-Way ANOVA calculator on this site: copy the group column and the score column from the Sheet, paste them in, and click Sort into groups & run. It prints the same Bonferroni follow-ups, with Tukey's HSD underneath for comparison.

A function you may see mentioned: FTEST. =FTEST(range1, range2) compares the variances of exactly two groups. It is not an ANOVA and cannot test three means, so do not use it for this unit's question.

UNIT 13

=F.INV.RT(α, df between, df within) — the critical F

What it does. Gives the cutoff where the rejection region begins for an F. α comes first, then the between-groups df (k − 1), then the within-groups df (N − k). If your F is at or beyond this number, reject H0. RT stands for right tail: F is never negative, so its rejection region is only on the right.

=F.INV.RT(0.05, 2, 197)   → 3.04    diet data: 3 groups, N = 200
=F.INV.RT(0.05, 2, 57)    → 3.16    break study: 3 groups, N = 60

How to read it. The diet F of 32.19 is far beyond 3.04, so reject H0. The decision always agrees with p: an F at or beyond F crit means p ≤ .05. Its partner =F.DIST.RT(F, df between, df within) runs it the other way and gives the p for an F.

Watch out. Keep the df in order: between first, within second. Swapped, =F.INV.RT(0.05, 197, 2) returns 19.49, a wrong cutoff.

UNIT 13

Bonferroni follow-ups: T.TEST type 3 and an absolute reference

The idea. A significant ANOVA says "some groups differ," not which ones. Sheets has no Tukey button, so we use the Bonferroni correction: run a t-test for each pair, and each one must beat α divided by the number of comparisons. Three diets means three pairs, so each must beat .05 ÷ 3 = .0167.

RowAEAF (type this)AF showsAG: decision
6Cutoff=0.05/30.0167
7Omni vs Veg=T.TEST(FILTER(Y2:Y201, X2:X201="Omnivore"), FILTER(Y2:Y201, X2:X201="Vegetarian"), 2, 3)7.2E-07Significant
8Omni vs Vegansame, with "Omnivore" and "Vegan"1.2E-06Significant
9Veg vs Vegansame, with "Vegetarian" and "Vegan"0.0176Not significant

The decision cell. In AG7 type:

=IF(AF7<$AF$6, "Significant", "Not significant")

then copy AG7 into AG8:AG9. The AF7 part shifts to AF8 and AF9 as you paste, which is what you want: each row checks its own p. The $AF$6 part does not shift, because the dollar signs lock it, so every row compares against the same cutoff. Without the dollar signs, the pasted formulas would drift to AF7 and AF8 and compare each p against the wrong cell.

Why type 3? Our groups are very unequal in size (136, 46, 18), so we do not assume equal variances. Type 3 is the Welch test, the safe choice for lopsided groups.

How to read row 9. .0176 misses the .0167 cutoff by a hair. Tukey's HSD (shown under the Bonferroni table in the site's calculator) gives that same pair p = .032, which is significant. Bonferroni is stricter. On close calls like this the two can disagree, which is why you always say which follow-up test you used.

Unit 14 · Two-Way ANOVA

Two grouping factors at once, with four cells in a 2 × 2 design. Sheets has no one-click two-way ANOVA, so we compute the part that builds the most understanding: the four cell means and the interaction graph. Unit 14 page →

UNIT 14

=AVERAGEIFS(value range, range1, "label1", range2, "label2") — one cell's mean

What it does. Averages only the rows that match both labels. Note the S, just as with COUNTIFS, and note the new order: the value range comes first, then pairs of where-to-look and what-to-match.

ArgumentMeaningExample (Vegan Study tab)
value rangeWhat to averageD5:D204 (self_compassion)
range1, "label1"First factor and its levelB5:B204, "USA" (country)
range2, "label2"Second factor and its levelC5:C204, "Vegan" (diet)

In class we use the Vegan Study (US-UK) tab: self-compassion by country × diet, 50 people per cell, data in rows 5 to 204.

=AVERAGEIFS(D5:D204, B5:B204, "USA", C5:C204, "Omnivore")   → 3.17
=AVERAGEIFS(D5:D204, B5:B204, "USA", C5:C204, "Vegan")      → 3.45
=AVERAGEIFS(D5:D204, B5:B204, "UK",  C5:C204, "Omnivore")   → 3.37
=AVERAGEIFS(D5:D204, B5:B204, "UK",  C5:C204, "Vegan")      → 3.04

How to read it. In the USA, vegans score higher on self-compassion than omnivores. In the UK, it flips. When the effect of one factor reverses across the levels of the other, that is an interaction, and here it is a crossover. Make a line chart with one line per country: lines that cross mean an interaction.

Marginal means use AVERAGEIF (one factor, no S):

=AVERAGEIF(B5:B204, "USA", D5:D204)        → 3.31   all US participants
=AVERAGEIF(B5:B204, "UK", D5:D204)         → 3.20   all UK participants
=AVERAGEIF(C5:C204, "Omnivore", D5:D204)   → 3.27   all omnivores
=AVERAGEIF(C5:C204, "Vegan", D5:D204)      → 3.24   all vegans

The diet marginals are almost identical (3.27 vs 3.24). Looking only at main effects, you would conclude diet does not matter. The cell means show it matters a great deal, in opposite directions. That is why you always look at the cells.

Same tool, main class dataset. The Unit 14 page also uses the stereotype-threat columns: math_score (T) by gender (B) × threat_condition (S).

=AVERAGEIFS(T2:T201, B2:B201, "Woman", S2:S201, "Control")   → 76.44
=AVERAGEIFS(T2:T201, B2:B201, "Woman", S2:S201, "Threat")    → 68.85
=AVERAGEIFS(T2:T201, B2:B201, "Man",   S2:S201, "Control")   → 79.23
=AVERAGEIFS(T2:T201, B2:B201, "Man",   S2:S201, "Threat")    → 80.59

Watch out: AVERAGEIF and AVERAGEIFS take their arguments in different orders. AVERAGEIF puts the value range last; AVERAGEIFS puts it first. Mix them up and Sheets averages the wrong column or errors out. The help box that pops up while you type always shows the right order.

Unit 15 · Chi-Square (Bonus)

Chi-square works on counts, not scores. Question: is our class a mini-America? National surveys put the U.S. adult diet mix at roughly 90% omnivore, 7% vegetarian, 3% vegan. Unit 15 page →

UNIT 15

=CHISQ.TEST(observed, expected) — goodness of fit

Step 1: build the observed and expected columns.

RowAEAF: observed (O)AG: expected (E)
2Omnivore=COUNTIF(X2:X201, "Omnivore") → 136=0.90*200 → 180
3Vegetarian=COUNTIF(X2:X201, "Vegetarian") → 46=0.07*200 → 14
4Vegan=COUNTIF(X2:X201, "Vegan") → 18=0.03*200 → 6
5Total=SUM(AF2:AF4) → 200=SUM(AG2:AG4) → 200

Expected = claimed proportion × N. Both columns must total 200.

Step 2: one function gives p.

=CHISQ.TEST(AF2:AF4, AG2:AG4)    → 3.7E-24

Step 3 (optional): see the χ² itself. CHISQ.TEST returns only p. To see the statistic, compute (O − E)² ÷ E for each row and add them:

AH2:  =(AF2-AG2)^2/AG2     → 10.76   copy into AH3:AH4 → 73.14, 24.00
AH5:  =SUM(AH2:AH4)        → 107.90  χ²

How to read it. χ²(2, N = 200) = 107.90, p < .001. Our class is not a miniature of the nation: it has far more vegetarians and vegans than the national mix predicts.

Watch out. Point CHISQ.TEST at rows 2 to 4 only, never the Total row. Including the totals counts every student twice and wrecks the answer.

UNIT 15

=CHISQ.INV.RT(α, df) and =CHISQ.DIST.RT(χ², df)

What they do. The same pair you met for t in Unit 10, now for chi-square. CHISQ.INV.RT gives the critical value; CHISQ.DIST.RT gives the p for a χ² you already have. "RT" means right tail, because chi-square tests only look at the upper tail.

=CHISQ.INV.RT(0.05, 2)       → 5.99      critical χ² for α = .05, df = 2
=CHISQ.DIST.RT(107.9, 2)     → 3.7E-24   p for our χ² (matches CHISQ.TEST)

Degrees of freedom. Goodness of fit: df = k − 1, the number of categories minus 1 (3 − 1 = 2). Test of independence: df = (rows − 1) × (columns − 1).

UNIT 15

Test of independence: COUNTIFS for observed, row × column ÷ N for expected

The question. Are two categorical variables related? Example: are commuters spread evenly across class years? This is a 2 × 4 table.

Observed counts come from COUNTIFS, one cell per combination:

=COUNTIFS(D2:D201, "Commuter", C2:C201, "Freshman")   → 37
=COUNTIFS(D2:D201, "Resident", C2:C201, "Freshman")   → 19
ObservedFreshmanSophomoreJuniorSeniorRow total
Commuter37404529151
Resident191191049
Column total56515439200

Expected counts come from the table itself: E = row total × column total ÷ N. For resident freshmen: =49*56/200 → 13.72. Build the full expected table the same way, cell by cell, in the same shape as the observed table.

=CHISQ.TEST(observed table, expected table)    → 0.19    χ²(3, N = 200) = 4.75

How to read it. p = .19 is above .05: fail to reject. Commuting status and class year are not significantly related in our data. The critical value for df = (2 − 1) × (4 − 1) = 3 is =CHISQ.INV.RT(0.05, 3) → 7.81, and 4.75 does not reach it.

Watch out. Select only the 8 count cells for each table, never the totals, and make sure the observed and expected tables have the same shape and the same order of rows and columns.

Which formula do I need?

On an exam, the hard part is often not typing the formula but choosing it. Start from the question.

The question asks…Reach for
How many in a category?COUNTIF (two categories at once: COUNTIFS)
How many scores in a range of values?COUNTIFS with ">=" and "<"
What is typical?AVERAGE; MEDIAN if skewed; MODE / MODE.MULT
How spread out?STDEV; VAR; MAX − MIN
Where does one score stand?STANDARDIZE, then NORM.S.DIST
What percent are above / below / between?NORM.DIST (1 − for above; subtract for between)
Do two number variables go together?CORREL
Predict Y from X?SLOPE, INTERCEPT, RSQ, FORECAST.LINEAR (Y first!)
How much do sample means wobble?STDEV/SQRT(COUNT)
One mean vs. a known value, σ knownz-test build: NORM.S.DIST
One mean vs. a known value, σ unknownOne-sample t build: T.DIST.2T
Two separate groupsT.TEST(FILTER, FILTER, 2, 2)
Same people twiceT.TEST(after, before, 2, 1)
Three or more groupsAVERAGEIF means + ANOVA calculator; follow-ups T.TEST(…, 2, 3)
Two factors at onceAVERAGEIFS cell means + line chart
Counts vs. a claim, or two categorical variablesCHISQ.TEST
Did I reject?IF(p<=0.05, "Reject H0", "Fail to reject H0")
Sigma says: Every test in this course is the same skeleton: (what you got − what the null predicts) ÷ how much it wobbles by chance. Sheets just hides the skeleton inside a function name. When a formula confuses you, take it apart from the inside out, one bracket at a time, and the skeleton shows through.