{
  "category": "Statistical functions",
  "display_name": "HARMEAN",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.HARMEAN",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20430"
      ],
      "larger_numeric": 0,
      "last_bit": 0,
      "matched": 19214,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 19214,
      "unread": 0,
      "worst_ulp": 0
    },
    "detail": "Recorded: 19,214 in the answer bank and 6 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 19,220 recorded answers",
    "workbook_corpus": {
      "cells": 6,
      "matched": 6
    }
  },
  "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#L238-L259"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/statistics::all",
        "catalogue/statistics::direct_first",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_x87_add",
        "ported/excel_numeric::excel_x87_div",
        "ported/excel_numeric::excel_x87_recip",
        "ported/excel_numeric/x87::add",
        "ported/excel_numeric/x87::div",
        "ported/excel_numeric/x87::recip"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/statistics.rs#L238-L259",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 19,220 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.HARMEAN.json",
  "name": "HARMEAN",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n[AVERAGE](FUNC.AVERAGE.md) suits equally weighted observations; [GEOMEAN](FUNC.GEOMEAN.md) suits multiplicative factors. Use a weighted harmonic mean when the portions are unequal.\n\n\n",
    "how-to-implement": "\nThe mathematical identity `n/sum(1/x)` is not the current operation tree. Use `R` for the [stored 64-bit-significand operation](../model/09-staged-arithmetic.md).\n\n1. Preserve whether each value is direct, a reference cell or an array element; collect it using the rules above. Reject any admitted `x<=0`.\n2. Starting from `S=0`, visit the admitted values in order. Store `r=R(1/x)`, then store `S=R(S+r)` for each one.\n3. After the empty-set and nonfinite-sum checks, store the reciprocal mean `m=R(S/n)`.\n4. Return `R(1/m)`, subject to worksheet number publication. Replacing these last two divisions by `R(n/S)` changes the intermediate rounding history.\n\nFor `30,60`, the mathematical reciprocal sum is `1/20`; the reciprocal mean is `1/40`, whose reciprocal is 40. The current staged route also publishes 40. These worked numbers explain the route; they do not identify all Excel rounding stages on every input.\n\nSmall positive inputs can make a reciprocal overflow. Scaling the reciprocal sum can help a mathematical implementation, but its different arithmetic needs separate Excel comparisons before being offered as a compatibility route.\n\n\n",
    "quirks": "\nEvery admitted value must be positive. A numeric zero or negative value gives `#NUM!`; a blank cell is skipped rather than treated as zero. References and arrays also skip logical values and text, including numeric-looking text. Direct numeric text and logical constants can be converted, so direct `FALSE` becomes a rejected zero.\n\nWorksheet errors propagate, and unconvertible direct text gives `#VALUE!`. The current code checks direct scalars before reading held values, returns `#N/A` when collection finds no numbers, and gives `#NUM!` for a nonfinite reciprocal sum. Those last two choices are implementation behaviour, not claims established by Microsoft’s published error list.\n\n\n",
    "sources": "\n- [Microsoft: HARMEAN function](https://support.microsoft.com/en-us/excel/functions/harmean-function), opened 6 November 2026; syntax, documented argument rules and errors.\n- [DnaCalc implementation](https://github.com/DnaCalc/DnaCalc/blob/da3ecc4fb19a3a5529708c311d0e8f05688ac165/crates/calc-func/src/catalogue/statistics.rs); implementation steps and the limits identified in the text.\n\n",
    "try-it": "\n`=HARMEAN(30,60)` returns `40`. Travelling 60 km at 30 km/h takes two hours; another 60 km at 60 km/h takes one hour. Total distance 120 km divided by total time three hours is 40 km/h.\n\n`=AVERAGE(30,60)` returns `45`. That is the average speed for equal amounts of time at the two speeds. The difference comes from what receives equal weight.\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 | 19,214 |\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.HARMEAN.json).",
    "what-it-does": "\n`HARMEAN(number1, [number2], ...)` returns `n / sum(1/x)` for positive observations. It is useful for rates attached to equal-sized portions. Two equal distances travelled at different speeds have equal distance weights, not equal time weights; averaging their speeds arithmetically answers a different question.\n\n\n"
  },
  "signature": {
    "display": "HARMEAN(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": "Statistical functions",
      "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": "Harmonic mean: n divided by the sum of the reciprocals",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the harmonic mean",
        "microsoft_url": "https://support.microsoft.com/en-us/office/harmean-function-5efd9184-fab5-42f9-b1d3-57883a1d3bc6"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "HARMEAN"
        },
        {
          "locale": "bg-BG",
          "name": "HARMEAN"
        },
        {
          "locale": "cs-CZ",
          "name": "HARMEAN"
        },
        {
          "locale": "da-DK",
          "name": "HARMIDDELVÆRDI"
        },
        {
          "locale": "de-DE",
          "name": "HARMEAN"
        },
        {
          "locale": "el-GR",
          "name": "HARMEAN"
        },
        {
          "locale": "en-AU",
          "name": "HARMEAN"
        },
        {
          "locale": "en-GB",
          "name": "HARMEAN"
        },
        {
          "locale": "en-US",
          "name": "HARMEAN"
        },
        {
          "locale": "es-ES",
          "name": "MEDIA.ARMO"
        },
        {
          "locale": "et-EE",
          "name": "HARMEAN"
        },
        {
          "locale": "fi-FI",
          "name": "KESKIARVO.HARM"
        },
        {
          "locale": "fr-FR",
          "name": "MOYENNE.HARMONIQUE*"
        },
        {
          "locale": "he-IL",
          "name": "HARMEAN"
        },
        {
          "locale": "hr-HR",
          "name": "HARMEAN"
        },
        {
          "locale": "hu-HU",
          "name": "HARM.KÖZÉP"
        },
        {
          "locale": "id-ID",
          "name": "HARMEAN"
        },
        {
          "locale": "it-IT",
          "name": "HARMEAN"
        },
        {
          "locale": "ja-JP",
          "name": "HARMEAN"
        },
        {
          "locale": "ko-KR",
          "name": "HARMEAN"
        },
        {
          "locale": "lt-LT",
          "name": "HARMEAN"
        },
        {
          "locale": "lv-LV",
          "name": "HARMEAN"
        },
        {
          "locale": "nb-NO",
          "name": "GJENNOMSNITT.HARMONISK"
        },
        {
          "locale": "nl-NL",
          "name": "HARM.GEM"
        },
        {
          "locale": "pl-PL",
          "name": "ŚREDNIA.HARMONICZNA"
        },
        {
          "locale": "pt-BR",
          "name": "HARMEAN"
        },
        {
          "locale": "pt-PT",
          "name": "MÉDIA.HARMÓNICA"
        },
        {
          "locale": "ro-RO",
          "name": "HARMEAN"
        },
        {
          "locale": "ru-RU",
          "name": "СРГАРМ"
        },
        {
          "locale": "sk-SK",
          "name": "HARMEAN"
        },
        {
          "locale": "sl-SI",
          "name": "HARMEAN"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "HARMEAN"
        },
        {
          "locale": "sv-SE",
          "name": "HARMMEDEL"
        },
        {
          "locale": "th-TH",
          "name": "HARMEAN"
        },
        {
          "locale": "tr-TR",
          "name": "HARORT işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "HARMEAN"
        },
        {
          "locale": "vi-VN",
          "name": "HARMEAN"
        },
        {
          "locale": "zh-CN",
          "name": "HARMEAN"
        },
        {
          "locale": "zh-HK",
          "name": "HARMEAN"
        },
        {
          "locale": "zh-TW",
          "name": "HARMEAN"
        }
      ],
      "signature": {
        "display": "HARMEAN(number1, [number2], ...)",
        "parameters": [
          {
            "description": null,
            "name": "number1",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "number2",
            "optional": true,
            "repeats": true
          }
        ],
        "trailing_repeats": true
      },
      "surface_name": "HARMEAN",
      "version_marker": null,
      "xlcall": {
        "code": "320",
        "symbol": "xlfHarmean"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/harmean-function-5efd9184-fab5-42f9-b1d3-57883a1d3bc6"
  },
  "try_it": {
    "formula": "=HARMEAN(30,60)"
  },
  "url": "https://handbook.dnacalc.com/functions/HARMEAN.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "19,214 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.",
      "excel_build": "16.0 build 20430",
      "platform": "Windows, 64-bit, CPU not recorded",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.HARMEAN.json"
      ]
    }
  ]
}