{
  "category": "Compatibility",
  "display_name": "VAR",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.VAR",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 1212,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 1212,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 1,212 in the answer bank and 90 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 1,302 recorded answers",
    "workbook_corpus": {
      "cells": 90,
      "matched": 90
    }
  },
  "implementations": [
    {
      "commit": "9e1884369a678158dd82d3d74188daf986995e87",
      "flavour": "excel-compatibility-candidate",
      "language": "Rust",
      "name": "CalcFunc",
      "own_code": [
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/statistics.rs#L335-L337"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/statistics::all",
        "catalogue/statistics::variance",
        "ported/excel_numeric::excel_sqrt_staged",
        "ported/variance_common::variance_from_values",
        "ported/variance_common::stdev_from_values"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/statistics.rs#L335-L337",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 1,302 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.VAR.json",
  "name": "VAR",
  "notes": [
    {
      "basis": "All 14,679 recorded rows of the twelve functions match: VAR.S, VAR.P, VAR, VARP, VARA, VARPA, STDEV.S, STDEV.P, STDEV, STDEVP, STDEVA and STDEVPA. Six of those rows separate the stored steps from plain binary64. 910 fresh scalar variance readings (Excel build 20527) replay exactly in rational arithmetic. Four cancellation edges were bisected to adjacent inputs; sixteen triples chosen to separate the stored ratio from 0.99*Q and from a division by 0.99 all agree with the ratio, where 0.99*Q misses all 16 and the division 14. Seven of eight magnitude brackets reach adjacent inputs, and sixteen chosen roots all need the 64-bit root followed by a store.",
      "documentation": null,
      "evidence": [
        {
          "commit": "9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18",
          "locator": "variance_from_values",
          "note": "the rules in the product; the commit message carries the row counts",
          "path": "crates/calc-func/src/ported/variance_common.rs",
          "repository": "DnaCalc"
        },
        {
          "commit": "9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18",
          "locator": "variance_cancellation_guard_stores_the_ratio",
          "note": "recorded answers pinned",
          "path": "crates/calc-func/tests/f1_stats.rs",
          "repository": "DnaCalc"
        },
        {
          "commit": "af74247e1ed54f0b535143f1305261b98d80d18e",
          "locator": null,
          "note": "rows matched per function",
          "path": "crates/calc-func/witness-status.tsv",
          "repository": "DnaCalc"
        },
        {
          "commit": "a547d79ed61948cfd5f5d49f8c5a2a071ad37635",
          "locator": null,
          "note": "the 14,679 rows before and after",
          "path": "evidence/round25/variance-published-canonical-scope-receipt.json",
          "repository": "DnaCalc-Research"
        }
      ],
      "functions": [
        "FUNC.STDEV",
        "FUNC.STDEV.P",
        "FUNC.STDEV.S",
        "FUNC.STDEVA",
        "FUNC.STDEVP",
        "FUNC.STDEVPA",
        "FUNC.VAR",
        "FUNC.VAR.P",
        "FUNC.VAR.S",
        "FUNC.VARA",
        "FUNC.VARP",
        "FUNC.VARPA"
      ],
      "inferred": "These tests were located with scalar arguments in separate cells; that the same edges hold for ranges and arrays is inferred, and their readings have not been taken. RN(variance*1000) <= |mean| is not separated from the rearrangement variance <= |mean|/1000. That a raw moment which overflows also takes the centered sum is inferred from recorded answers that stay finite.",
      "kind": "excel-differs-from-math",
      "note_id": "FN-VAR.S-001",
      "open": [
        "Whether the two tests keep the same edges for ranges and arrays."
      ],
      "recorded_on": "2026-11-04",
      "repros": [
        {
          "call": "VAR.S(0.8769085090206681, 1, 1.123091490979332)",
          "correct": null,
          "excel": {
            "bits": "0x3f8f07c1f07c1e94",
            "display": "0.01515151515151495",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number1",
              "value": {
                "bits": "0x3fec0fa26efa7e14",
                "display": "0.8769085090206681",
                "kind": "number"
              }
            },
            {
              "name": "number2",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            },
            {
              "name": "number3",
              "value": {
                "bits": "0x3ff1f82ec882c0f6",
                "display": "1.123091490979332",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading",
          "source": {
            "commit": "9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18",
            "locator": "variance_cancellation_guard_keeps_the_observed_edge",
            "note": null,
            "path": "crates/calc-func/tests/f1_stats.rs",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "VAR.S(0.8769085090206679, 1, 1.1230914909793321)",
          "correct": {
            "bits": "0x3f8f07c1f07c1eb4",
            "display": "0.015151515151515006",
            "how": "Exact rational variance of the binary64 inputs, correctly rounded.",
            "kind": "number"
          },
          "excel": {
            "bits": "0x3f8f07c1f07c1f00",
            "display": "0.015151515151515138",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number1",
              "value": {
                "bits": "0x3fec0fa26efa7e12",
                "display": "0.8769085090206679",
                "kind": "number"
              }
            },
            {
              "name": "number2",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            },
            {
              "name": "number3",
              "value": {
                "bits": "0x3ff1f82ec882c0f7",
                "display": "1.1230914909793321",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading",
          "source": {
            "commit": "9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18",
            "locator": "variance_cancellation_guard_keeps_the_observed_edge",
            "note": null,
            "path": "crates/calc-func/tests/f1_stats.rs",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "VAR.S(3.244042371786199e-10, 0.00034050419142641947)",
          "correct": null,
          "excel": {
            "bits": "0x3e6f1f88c6bbc51a",
            "display": "5.797144172853e-08",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number1",
              "value": {
                "bits": "0x3df64afacd3a935a",
                "display": "3.244042371786199e-10",
                "kind": "number"
              }
            },
            {
              "name": "number2",
              "value": {
                "bits": "0x3f3650b65dc7a1d6",
                "display": "0.00034050419142641947",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading",
          "source": {
            "commit": "9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18",
            "locator": "variance_centered_guard_uses_the_absolute_mean",
            "note": null,
            "path": "crates/calc-func/tests/f1_stats.rs",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "VAR.S(1.2976169487144796e-09, 0.0013620167657056779)",
          "correct": {
            "bits": "0x3eaf1f88c6bbc51a",
            "display": "9.2754306765648e-07",
            "how": "Exact rational variance of the binary64 inputs, correctly rounded.",
            "kind": "number"
          },
          "excel": {
            "bits": "0x3eaf1f88c6bbc519",
            "display": "9.275430676564799e-07",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number1",
              "value": {
                "bits": "0x3e164afacd3a935a",
                "display": "1.2976169487144796e-09",
                "kind": "number"
              }
            },
            {
              "name": "number2",
              "value": {
                "bits": "0x3f5650b65dc7a1d6",
                "display": "0.0013620167657056779",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading",
          "source": {
            "commit": "9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18",
            "locator": "variance_centered_guard_uses_the_absolute_mean",
            "note": null,
            "path": "crates/calc-func/tests/f1_stats.rs",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "=VAR.S({157,376.82,189.207,12.38,12.473,483,306.24,324.1852,482.235,78})",
          "correct": {
            "bits": "0x40df28debfbf8a7f",
            "display": "31907.480453381777",
            "how": "Exact rational variance of the binary64 inputs, correctly rounded.",
            "kind": "number"
          },
          "excel": {
            "bits": "0x40df28debfbf8a84",
            "display": "31907.480453381795",
            "kind": "number"
          },
          "input_route": "formula-literal",
          "inputs": [],
          "recorded_in": "Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA",
          "source": {
            "commit": "c9f9d354165d2c20b9455c32582ea50baac7ba73",
            "locator": "sheet dcj9k_statistics, row 3, column 4",
            "note": null,
            "path": "crates/calc-func/tests/captures/catalogue/sections/dcj9k_statistics.capture.json",
            "repository": "DnaCalc"
          }
        },
        {
          "call": "STDEV.S(0, 1, 1.031052478719249)",
          "correct": null,
          "excel": {
            "bits": "0x3fe2c4c55ae2d85e",
            "display": "0.5865198874587454",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "number1",
              "value": {
                "bits": "0x0000000000000000",
                "display": "0",
                "kind": "number"
              }
            },
            {
              "name": "number2",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            },
            {
              "name": "number3",
              "value": {
                "bits": "0x3ff07f30e248f14c",
                "display": "1.031052478719249",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading",
          "source": {
            "commit": "9c23b24e8d0a6bc913f16bc169f46f80d4e6bb18",
            "locator": "stdev_stores_the_extended_square_root",
            "note": null,
            "path": "crates/calc-func/tests/f1_stats.rs",
            "repository": "DnaCalc"
          }
        }
      ],
      "schema": "efh.function-note/v1",
      "statement": "With RN(v) meaning v rounded to 64 bits on the x87 unit and then stored to binary64, S the running RN sum of the n values and Q the running RN sum of RN(x*x), the sample variance is RN(RN(Q - RN(RN(S*S)/n))/(n-1)) and the population variance RN(RN(RN(n*Q) - RN(S*S))/RN(n*n)). Excel then uses a centered sum instead, adding RN(d*d) with d = RN(x - mean) and dividing by n-1 or n, when either of two stored tests holds: RN(RN(RN(S*S)/n)/Q) > 0.99, or RN(variance*1000) <= |RN(S/n)|. The STDEV functions are the root of this, rounded to 64 bits and then stored. So the answer depends on which path a call takes: the first two VAR.S calls below differ by a few input steps in two arguments, the first passes the 0.99 test and is correctly rounded, and the second takes the raw moments and lands 76 units high. The next pair shows the size test: scaling the inputs by 4 leaves the first path.",
      "status": "measured",
      "title": "The variance family uses raw moments with stored steps, and two tests switch it to a centered sum"
    }
  ],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\nUse [VAR.S](FUNC.VAR.S.md) as the explicit modern spelling of sample variance. [VAR.P](FUNC.VAR.P.md) uses the population divisor, and [STDEV.S](FUNC.STDEV.S.md) returns a standard deviation in the original units.\n\n\n\n\n",
    "how-to-implement": "\nApply the collection rules above, then use the [stored variance recipe](FUNC.VAR.S.md#how-to-implement). This function uses the **sample** branch, with final divisor `n-1` and no square root.\n\nFor the three values `-2,0,2`, the stored totals are `S=0`, `Q=8`, `T=0`. The sample numerator is `8-0/3=8` and the divisor is `2`. Do not replace the population operation tree by the sample tree with a changed final divisor.\n\nThe same two guards can redirect this call to the centered pass. For `1000,1001,1002`, that pass sums `1+0+1=2` and divides by `2`. The exact scalar guard edges are measured; their transfer to references and arrays remains open. Nonfinite raw-moment fallback is inferred. No Handbook vector suite is published for this function.\n\n\n",
    "quirks": "\nNumbers in references and arrays count, including zero; referenced text, logical values and empty cells do not. Direct logical values and numeric text can count, so moving a constant into a cell can change the admitted data set. An empty numeric set gives `#DIV/0!` and a one-value sample does too. A centered mathematical formula alone does not reproduce the observed numerical path.\n\n\n",
    "sources": "\n- [Microsoft: VAR function](https://support.microsoft.com/en-us/office/var-function-1f2b7ab2-954d-4e17-ba2c-9e58b15a7da2), opened 6 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/ported/variance_common.rs); implementation steps and the limits identified in the text.\n- [FN-VAR.S-001](../notes/FN-VAR.S-001.json): guard bisections, stored arithmetic and unresolved scope.\n\n",
    "try-it": "\n`=VAR(-2,0,2)` returns `4`. The mean is zero and the squared deviations total eight. Divide by two.\n\n\n",
    "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.\n\n| Excel 16.0 build | Platform and CPU | Captured inputs |\n|---|---|---:|\n| 20430 | Windows, 64-bit, CPU not recorded | 1,212 |\n\nThe 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.\n\n[Recorded environments and comparison details](https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.VAR.json).\n\nRetained controls from the indexed captures:\n\n| Build and recorded CPU | Captured call or arguments | Excel result |\n|---|---|---|\n| 20430, CPU not recorded | [`VAR(1,2)`](https://github.com/DnaCalc/CalcFunc-Evidence/blob/4287ba192d2e3a7fd54671ea1cee1c34cb2e84e2/cache/w111-broad-regenerated-20260929/answers-var.json.gz) | `0.5` (`0x3fe0000000000000`) |\n\nThese are earlier recorded answers, not new Excel runs or an additional cross-build comparison. The function JSON retains each source locator, exact argument bits where available, and input-route status. Call notation does not imply that captured binary64 values were entered as decimal formula literals.",
    "what-it-does": "\n`VAR(number1, [number2], ...)` measures sample variance. It measures squared distance from the mean, so its units are the square of the input units. The divisor is `n-1`: use this when the observations are a sample of a larger population. It is a compatibility name; the dotted name makes the sample/population choice clearer in new workbooks.\n\n\n"
  },
  "signature": {
    "display": "VAR(number1, [number2], ...)",
    "parameters": [
      {
        "description": null,
        "name": "number1",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "number2",
        "optional": true,
        "repeats": true
      }
    ],
    "trailing_repeats": true
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 255,
        "min": 1
      },
      "category": "Compatibility",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "AggregateDirectAndRangeDualPolicy",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "NumsToNum",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Sample variance (older form)",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Estimates variance based on a sample",
        "microsoft_url": "https://support.microsoft.com/en-us/office/var-function-1f2b7ab2-954d-4e17-ba2c-9e58b15a7da2"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "VAR"
        },
        {
          "locale": "bg-BG",
          "name": "VAR"
        },
        {
          "locale": "cs-CZ",
          "name": "VAR.VÝBĚR"
        },
        {
          "locale": "da-DK",
          "name": "VARIANS"
        },
        {
          "locale": "de-DE",
          "name": "VARIANZ"
        },
        {
          "locale": "el-GR",
          "name": "VAR"
        },
        {
          "locale": "en-AU",
          "name": "VAR"
        },
        {
          "locale": "en-GB",
          "name": "VAR"
        },
        {
          "locale": "en-US",
          "name": "VAR"
        },
        {
          "locale": "es-ES",
          "name": "VAR"
        },
        {
          "locale": "et-EE",
          "name": "VAR"
        },
        {
          "locale": "fi-FI",
          "name": "VAR"
        },
        {
          "locale": "fr-FR",
          "name": "VAR"
        },
        {
          "locale": "he-IL",
          "name": "VAR"
        },
        {
          "locale": "hr-HR",
          "name": "VAR"
        },
        {
          "locale": "hu-HU",
          "name": "VAR"
        },
        {
          "locale": "id-ID",
          "name": "VAR"
        },
        {
          "locale": "it-IT",
          "name": "VAR"
        },
        {
          "locale": "ja-JP",
          "name": "VAR"
        },
        {
          "locale": "ko-KR",
          "name": "VAR"
        },
        {
          "locale": "lt-LT",
          "name": "VAR"
        },
        {
          "locale": "lv-LV",
          "name": "VAR"
        },
        {
          "locale": "nb-NO",
          "name": "VARIANS"
        },
        {
          "locale": "nl-NL",
          "name": "VAR"
        },
        {
          "locale": "pl-PL",
          "name": "WARIANCJA"
        },
        {
          "locale": "pt-BR",
          "name": "VAR"
        },
        {
          "locale": "pt-PT",
          "name": "VAR"
        },
        {
          "locale": "ro-RO",
          "name": "VAR"
        },
        {
          "locale": "ru-RU",
          "name": "ДИСП"
        },
        {
          "locale": "sk-SK",
          "name": "VAR"
        },
        {
          "locale": "sl-SI",
          "name": "VAR"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "VAR"
        },
        {
          "locale": "sv-SE",
          "name": "VARIANS"
        },
        {
          "locale": "th-TH",
          "name": "VAR"
        },
        {
          "locale": "tr-TR",
          "name": "VAR"
        },
        {
          "locale": "uk-UA",
          "name": "VAR"
        },
        {
          "locale": "vi-VN",
          "name": "VAR"
        },
        {
          "locale": "zh-CN",
          "name": "VAR"
        },
        {
          "locale": "zh-HK",
          "name": "VAR"
        },
        {
          "locale": "zh-TW",
          "name": "VAR"
        }
      ],
      "signature": {
        "display": "VAR(number1, [number2], ...)",
        "parameters": [
          {
            "description": null,
            "name": "number1",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "number2",
            "optional": true,
            "repeats": true
          }
        ],
        "trailing_repeats": true
      },
      "surface_name": "VAR",
      "version_marker": null,
      "xlcall": {
        "code": "46",
        "symbol": "xlfVar"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/var-function-1f2b7ab2-954d-4e17-ba2c-9e58b15a7da2"
  },
  "try_it": {
    "formula": "=VAR(-2,0,2)"
  },
  "url": "https://handbook.dnacalc.com/functions/VAR.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "1,212 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. Retained control VAR(1,2) returned 0.5 (0x3fe0000000000000). The capture specifies exact-double bulk Value2 cell input.",
      "excel_build": "16.0 build 20430",
      "observations": [
        {
          "call": "VAR(1,2)",
          "excel": {
            "bits": "0x3fe0000000000000",
            "display": "0.5",
            "kind": "number"
          },
          "input_route": "cell-value2",
          "inputs": [
            {
              "name": "argument1",
              "value": {
                "bits": "0x3ff0000000000000",
                "display": "1",
                "kind": "number"
              }
            },
            {
              "name": "argument2",
              "value": {
                "bits": "0x4000000000000000",
                "display": "2",
                "kind": "number"
              }
            }
          ],
          "recorded_in": "Excel 16.0 build 20430, Windows, 64-bit, CPU not recorded.",
          "source": {
            "commit": "4287ba192d2e3a7fd54671ea1cee1c34cb2e84e2",
            "locator": "w111broad-20260929-VAR-00003",
            "path": "cache/w111-broad-regenerated-20260929/answers-var.json.gz",
            "repository": "CalcFunc-Evidence"
          }
        }
      ],
      "platform": "Windows, 64-bit, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.VAR.json",
        "https://github.com/DnaCalc/CalcFunc-Evidence/blob/4287ba192d2e3a7fd54671ea1cee1c34cb2e84e2/cache/w111-broad-regenerated-20260929/answers-var.json.gz"
      ]
    }
  ]
}