Statistical functions

DEVSQ

Matches all 23,172 recorded answers

Recorded: 23,106 in the answer bank and 66 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicDEVSQ
BulgarianDEVSQ
CzechDEVSQ
DanishSAK
GermanDEVSQ
GreekDEVSQ
English (Australia)DEVSQ
English (United Kingdom)DEVSQ
English (United States)DEVSQ
SpanishDESVIA2
EstonianDEVSQ
FinnishOIKAISTU.NELIÖSUMMA
FrenchSOMME.CARRES.ECARTS
HebrewDEVSQ
CroatianDEVSQ
HungarianSQ
IndonesianDEVSQ
ItalianDEVSQ
JapaneseDEVSQ
KoreanDEVSQ
LithuanianDEVSQ
LatvianDEVSQ
NorwegianDEVSQ
DutchDEV.KWAD
PolishODCH.KWADRATOWE
Portuguese (Brazil)DEVSQ
Portuguese (Portugal)DESVQ
RomanianDEVSQ
RussianКВАДРОТКЛ
SlovakDEVSQ
SlovenianDEVSQ
Serbian (Latin)DEVSQ
SwedishKVADAVV
ThaiDEVSQ
TurkishSAPKARE işlevi
UkrainianDEVSQ
VietnameseDEVSQ
Chinese (Simplified)DEVSQ
Chinese (Hong Kong)DEVSQ
Chinese (Traditional)DEVSQ

Names from Microsoft's support site.

What it does

DEVSQ(number1, [number2], ...)

DEVSQ(number1, [number2], ...) returns the sum of squared distances from the data’s mean. It supplies a centered variance numerator without choosing either the sample or population divisor. If the observations are lengths, the result has squared-length units.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

=DEVSQ(2,4,6) returns 8: the mean is four and the squared deviations are four, zero and four.

Quirks

Referenced or array text, logical values and blanks are skipped; a numeric zero is an observation. Direct logical values and numeric text can be converted. Worksheet errors propagate, and unconvertible direct text gives #VALUE!. In the current code, direct scalar errors are checked before errors reached through a reference or array.

The current implementation returns #NUM! for no collected numbers. A single number has zero deviation from its own mean and returns zero. Adding a constant to all observations leaves the mathematical answer unchanged, but a floating-point implementation can lose that property at extreme magnitudes.

How to implement

The current code uses a centered pass with a particular mixture of operations:

  1. Collect the numeric observations in their argument and traversal order. Reject an empty collection with #NUM!.
  2. Sum the observations in ordinary binary64 and divide that sum by n in binary64 to obtain mean.
  3. For each observation, store the ordinary binary64 subtraction d=x-mean.
  4. Compute the square using R(d*d), where R rounds to a 64-bit significand and then stores to binary64. Replace a square below the minimum normal binary64 value by zero.
  5. Add these squares in ordinary binary64 and publish the sum. Do not divide it by n or n-1.

For 2,4,6, the sum is 12 and the mean is four. Differences -2,0,2 give squares 4,0,4 and total eight. By comparison, SUMSQ(2,4,6)=56 squares the uncentered inputs.

A direct calculation sum(x*x)-sum(x)^2/n is mathematically equivalent but can subtract two large, nearly equal quantities. It also has a different operation tree from this code. The stated mixed-store route is an implementation recipe; no whole-domain Excel stage identification is claimed.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

DEVSQ · 17 lines · calc-func/src/catalogue/statistics.rs on GitHub
2 devsq "DEVSQ" (1, 255) [R "number1", R "number2"] |s, a, sv| {
    direct_first(s, a)?;
    let values = all(s, a, sv, Held::Numbers)?;
    if values.is_empty() {
        return fail(WorksheetErrorCode::Num);
    }
    let mean = values.iter().sum::<f64>() / values.len() as f64;
    let devsq = values
        .iter()
        .map(|v| {
            let delta = v - mean;
            let square = k::excel_numeric::excel_x87_mul(delta, delta);
            if square < f64::MIN_POSITIVE { 0.0 } else { square }
        })
        .sum::<f64>();
    s.number(devsq)
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
20430Windows, 64-bit, CPU not recorded23,096

The record contains no same-input comparison between these environments. Reading different inputs on different builds does not establish either a version change or cross-build agreement.

Recorded environments and comparison details.

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

23,096 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build.

Alternatives

VAR.S divides a variance numerator by n-1; VAR.P uses n. SUMSQ squares the original values without centering.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents