DEVSQ function
Returns the sum of squared deviations of numbers from their mean, the raw ingredient of variance, standard deviation and ANOVA.
Available in All versions of Excel, Excel for the web, Excel for Mac
In every Excel versionWorks in Google Sheets
Syntax
DEVSQ(number1, [number2], ...)| Argument | What it means | |
|---|---|---|
number1 | Required | The first number, cell or range. |
number2, ... | Optional | Up to 254 more numbers or ranges. |
Returns: A non-negative number: Σ(x − mean)².
How DEVSQ works
DEVSQ measures total variation. It finds the mean, subtracts it from each value, squares the differences (so negatives do not cancel positives) and adds them up. On its own the number grows with the amount of data, so it is rarely reported directly, but it is the starting point of many statistics: divide by n − 1 for the sample variance, by n for the population variance, and compare DEVSQ values between and within groups to run an analysis of variance (ANOVA).
Blank cells, text and logical values in a range are ignored, the same rule as AVERAGE. Knowing DEVSQ helps you see where formulas like VAR.S come from, and lets you build your own ANOVA or regression tables without the Analysis ToolPak.
Examples
1Total variation in ticket times
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Ticket | Hours | ||
| 2 | T-301 | 4 | 26 | |
| 3 | T-302 | 6 | ||
| 4 | T-303 | 3 | ||
| 5 | T-304 | 9 | ||
| 6 | T-305 | 8 |
Result: 26
The mean is 6. The deviations are −2, 0, −3, 3 and 2; squared they are 4, 0, 9, 9 and 4, which add up to 26.
2From DEVSQ to sample variance
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Day | Temp (°C) | ||
| 2 | 1 | 18.5 | 2.1417 | |
| 3 | 2 | 21 | ||
| 4 | 3 | 19.5 | ||
| 5 | 4 | 22.5 | ||
| 6 | 5 | 20 | ||
| 7 | 6 | 19 |
Result: 2.1417
DEVSQ returns 10.7083; dividing by 6 − 1 = 5 gives 2.1417, exactly what =VAR.S(B2:B7) returns (formatted to 4 decimal places).
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | No numbers were found in the arguments. | Check the range contains real numbers. |
Tips
- In a one-way ANOVA, total DEVSQ of all values = DEVSQ within groups + DEVSQ between groups. Comparing the two parts is what the F test does.
Google Sheets
DEVSQ also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
DEVSQ in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | SAK |
| Dutch | DEV.KWAD |
| Finnish | OIKAISTU.NELIÖSUMMA |
| French | SOMME.CARRES.ECARTS |
| German | SUMQUADABW |
| Hungarian | SQ |
| Italian | DEV.Q |
| Norwegian (Bokmål) | AVVIK.KVADRERT |
| Polish | ODCH.KWADRATOWE |
| Portuguese (Brazil) | DESVQ |
| Portuguese (Portugal) | DESVQ |
| Russian | КВАДРОТКЛ |
| Spanish | DESVIA2 |
| Swedish | KVADAVV |
| Turkish | SAPKARE |