How to calculate a z-score
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)How many standard deviations a value sits from the mean — outlier detection, comparing across scales.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =(A2-AVERAGE($A$2:$A$100))/STDEV.P($A$2:$A$100) | Or the built-in =STANDARDIZE(A2,AVERAGE(...),STDEV.P(...)). Use STDEV.S for sample data. |
| Google Sheets | =(A2-AVERAGE($A$2:$A$100))/STDEV.P($A$2:$A$100) | Identical, including STANDARDIZE. |
| LibreOffice Calc | =(A2-AVERAGE($A$2:$A$100))/STDEV.P($A$2:$A$100) | Identical. |
How it works
Subtract the mean, divide by the standard deviation: the 6 in this data (mean 4, σ ≈ 1.265) is 1.58 standard deviations above average. Z-scores make different scales comparable — a 1.58 on test A means the same relative standing as a 1.58 on test B — and power the common |z| > 3 outlier rule. Population vs sample deviation (P vs S) changes the denominator slightly; be consistent across the column, and see the standard-deviation recipe for which to pick.
Verified, not just documented
We ran =ROUND((A6-AVERAGE(A2:A6))/STDEV.P(A2:A6),4) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 1.5811 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 1.5811 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
AVERAGE · STDEV.P — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to average a range of times
- How to average a range that contains errors
- How to average the top N scores (drop the lowest)
- How to average the last N values in a growing column
- How to calculate a moving average