Statistical function

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], ...)
ArgumentWhat it means
number1RequiredThe first number, cell or range.
number2, ...OptionalUp 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

D2fx=DEVSQ(B2:B6)
ABCD
1TicketHours
2T-301426
3T-3026
4T-3033
5T-3049
6T-3058

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

D2fx=DEVSQ(B2:B7)/(COUNT(B2:B7)-1)
ABCD
1DayTemp (°C)
2118.52.1417
3221
4319.5
5422.5
6520
7619

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).

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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.

LanguageFunction name
DanishSAK
DutchDEV.KWAD
FinnishOIKAISTU.NELIÖSUMMA
FrenchSOMME.CARRES.ECARTS
GermanSUMQUADABW
HungarianSQ
ItalianDEV.Q
Norwegian (Bokmål)AVVIK.KVADRERT
PolishODCH.KWADRATOWE
Portuguese (Brazil)DESVQ
Portuguese (Portugal)DESVQ
RussianКВАДРОТКЛ
SpanishDESVIA2
SwedishKVADAVV
TurkishSAPKARE