{
  "category": "Financial functions",
  "display_name": "MDURATION",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.MDURATION",
  "implementation_state": {
    "answer_bank": {
      "excel_builds": [
        "20131",
        "?"
      ],
      "larger_numeric": 0,
      "last_bit": 157,
      "matched": 1103,
      "other_mismatch": 0,
      "refused": 0,
      "rows": 1260,
      "unread": 0,
      "worst_ulp": 3
    },
    "detail": "Everything else matches (1,260 in the answer bank and 6 workbook cells). Last-bit means a finite number within 16 ULP of Excel's.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "close",
    "state_label": "Close: last-bit deviations remain",
    "summary": "Close: 157 of 1,266 recorded answers differ in the last bits, worst 3 ULP",
    "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/bonds.rs#L141-L144",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/ported/bond_core_family.rs#L654-L667"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/bonds::or",
        "catalogue/bonds::bond_out",
        "catalogue/financial::date_1900",
        "locale::days_from_civil",
        "locale::civil_from_days",
        "locale::excel_serial_from_ymd",
        "locale::ymd_from_excel_serial",
        "ported/bond_core_family::max_serial",
        "ported/bond_core_family::derr",
        "ported/bond_core_family::dyear",
        "ported/bond_core_family::dim",
        "ported/bond_core_family::act",
        "ported/bond_core_family::basis",
        "ported/bond_core_family::freq",
        "ported/bond_core_family::dser",
        "ported/bond_core_family::rate",
        "ported/bond_core_family::addm",
        "ported/bond_core_family::d360eu",
        "ported/bond_core_family::dc",
        "ported/bond_core_family::ctx",
        "ported/bond_core_family::period",
        "ported/bond_core_family::excel_bond_pow",
        "ported/bond_core_family::duration_kernel",
        "ported/bond_core_family::last_day_of_feb",
        "ported/bond_core_family::diff360_us",
        "ported/bond_core_family::days_between_num",
        "ported/bond_core_family::map_bond_core_error_to_ws",
        "ported/excel_numeric::binary_with",
        "ported/excel_numeric::excel_pow_chain",
        "ported/excel_numeric::excel_x87_mul",
        "ported/excel_numeric/x87::mul",
        "ported/excel_numeric/x87_chains::pow2_positive",
        "ported/excel_numeric/x87_chains::pow2",
        "ported/excel_numeric/x87_chains::exp_ext",
        "ported/excel_numeric/x87_chains::exp_with",
        "ported/excel_numeric/x87_chains::excel_exp",
        "ported/excel_numeric/x87_chains::log_with",
        "ported/excel_numeric/x87_chains::excel_log"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/bonds.rs#L141-L144",
      "state": "close",
      "suite": null,
      "summary": "Close: 157 of 1,266 recorded answers differ in the last bits, worst 3 ULP"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.MDURATION.json",
  "name": "MDURATION",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\n### Relationships\n\n\n- **[DURATION](FUNC.DURATION.md)** — Macaulay duration, the numerator. The relation\n  `MDURATION = DURATION/(1 + yld/frequency)` is exact in the definition and is the natural\n  metamorphic test for both functions at once.\n- **`PRICE`** — the price whose sensitivity `MDURATION` measures. Together they give the standard\n  first-order estimate `ΔP ≈ −MDURATION × P × Δy`, and comparing that estimate against a direct\n  re-pricing at the shifted yield is the honest way to see how far first order gets you.\n- **`YIELD`** — the usual source of `yld`.\n- **`COUPNUM` / `COUPDAYBS` / `COUPDAYS`** — the schedule instruments for localizing a\n  disagreement, exactly as for `DURATION`.\n- **Confused with**: Macaulay duration itself. The two differ by a factor that, for a semi-annual\n  bond at a 6% yield, is about 3% — small enough to look like a rounding difference and large\n  enough to matter in a hedge ratio.\n- **Not available**: convexity, the second-order term. Excel provides no function for it.\n\n\n",
    "how-to-implement": "\n### Numerical notes\n\n\nThe additional arithmetic is one division by `1 + yld/frequency`, a quantity of order 1 for any\nadmissible input. It introduces one rounding and no instability: there is no cancellation, no\noverflow, and the divisor cannot approach zero inside the admissible domain because `yld < 0` is\nrejected.\n\nThat makes `MDURATION` a clean amplifier for whatever `DURATION` does. All the genuine numerical\ndifficulty — the backwards coupon schedule with its end-of-month rule, the 30/360 accrual variants\nand the order in which their start-date and end-date adjustments apply, the two different `pow`\nstagings for integer and fractional discount exponents — belongs to `DURATION` and is discussed on\nthat page. `MDURATION` inherits every one of them and can add at most one ULP of its own.\n\nOne consequence worth stating: because the two functions differ by an exactly specified division, a\ndisagreement between an implementation's `MDURATION` and `DURATION/(1 + yld/f)` computed on the\nsheet is diagnostic. If the identity holds, any error is in the schedule or the discounting; if it\nfails, the implementation has computed modified duration by some other route.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns `Number` — a modified duration in years.\n\n- **`settlement ≥ maturity`** is a domain error.\n- **`yld = 0`** makes `MDURATION` and `DURATION` identical; that equality is a useful self-test.\n- **One remaining coupon**: inherits `DURATION`'s single-term branch, then divides.\n- **Every day-count and schedule subtlety of `DURATION` is present here unchanged.** Modified\n  duration adds no new calendar behaviour whatsoever; it adds one division. If an `MDURATION`\n  answer looks wrong, check `DURATION` first — the fault is almost certainly upstream of the\n  division.\n- Empty, missing and error arguments follow the shared call model; see\n  [The value universe](../model/01-value-universe.md) and\n  [Coercion and lifting](../model/02-coercion-and-lifting.md).\n\n\n\n### Errors\n\n\nAs documented on Microsoft's `MDURATION` page:\n\n| Error | Condition |\n|---|---|\n| `#VALUE!` | `settlement` or `maturity` is not a valid serial date number |\n| `#NUM!` | `coupon < 0` or `yld < 0` |\n| `#NUM!` | `frequency` is any number other than 1, 2 or 4 |\n| `#NUM!` | `basis < 0` or `basis > 4` |\n| `#NUM!` | `settlement ≥ maturity` |\n\nThe `yld < 0` restriction deserves the same note it gets on the `DURATION` page: a negative-yield\nbond has **no modified duration in Excel**, even though the sensitivity is perfectly well defined\nand is precisely the quantity a desk holding negative-yielding paper needs. This is a documented\ndomain restriction, not a mathematical one.\n\n",
    "sources": "- Microsoft, \"MDURATION function\" —\n  <https://support.microsoft.com/en-us/office/mduration-function-b3786a69-4f20-469a-94ad-33e5b90a763c>\n  (syntax, the \"Macauley modified duration\" description, argument meanings, frequency values, the\n  day-count basis table, the truncation remarks, and the documented `#VALUE!` and `#NUM!`\n  conditions).\n- Handbook, [DURATION](FUNC.DURATION.md) — the Macaulay numerator, its schedule construction and the\n  numerical discussion this page defers to.\n- Handbook, [The value universe](../model/01-value-universe.md) and\n  [Coercion and lifting](../model/02-coercion-and-lifting.md).\n- Handbook projections `data/functions/FUNC.MDURATION.json` and\n  `data/presence/FUNC.MDURATION.json`.\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| 20131 | Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics | 1,260 |\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.MDURATION.json).",
    "what-it-does": "\n`MDURATION(settlement, maturity, coupon, yld, frequency, [basis])` returns the **modified duration**\nof a coupon bond with an assumed par value of 100.\n\nThe definition is one division applied to Macaulay duration:\n\n    MDURATION = DURATION / (1 + yld/frequency)\n\nand that division is what converts a *time* into a *sensitivity*. Where Macaulay duration answers\n\"on average, how far away is my money\", modified duration answers \"if the yield moves, how much\ndoes the price move\":\n\n    dP/dy = −MDURATION × P            equivalently        ΔP/P ≈ −MDURATION × Δy\n\nSo a modified duration of 7.2 means a one-percentage-point rise in yield costs roughly 7.2% of the\nprice. It is a **first-order** statement: the price/yield curve is convex, so the linear estimate\noverstates losses on a rise and understates gains on a fall, and the error grows with the square of\n`Δy`. Excel has no convexity function to supply the second-order correction.\n\nUnits are years, inherited from `DURATION`; the quantity is often read as \"per unit change in\nyield\", which is dimensionally the same thing because yield is per year.\n\nMicrosoft's page names the result **\"Macauley modified duration\"** — with that spelling of\nMacaulay. It is worth knowing so that searches match.\n\nLimiting cases follow `DURATION`'s directly, damped by the divisor:\n\n- **Zero coupon**: `MDURATION` is the time to maturity divided by `1 + yld/frequency`, so it is\n  strictly less than the time to maturity for any positive yield.\n- **`yld = 0`**: the divisor is 1 and modified duration equals Macaulay duration exactly.\n- **`yld → −frequency`**: the divisor approaches zero and the quantity diverges — but that region is\n  excluded from the admissible domain long before it is reached, because `yld < 0` is an error.\n\n\n\n### Arguments\n\n\n| Argument | Meaning | Default |\n|---|---|---|\n| `settlement` | The settlement date. Required. | — |\n| `maturity` | The maturity date. Required. | — |\n| `coupon` | The security's **annual** coupon rate, as a decimal fraction. Required. | — |\n| `yld` | The security's **annual** yield, as a decimal fraction. Required. | — |\n| `frequency` | Coupon payments per year: `1` annual, `2` semi-annual, `4` quarterly. Required. | — |\n| `basis` | The day-count basis. Optional. | 0 |\n\nIdentical to [DURATION](FUNC.DURATION.md), and the same three traps apply: `coupon` and `yld` are\n**annual** rates even at `frequency = 2` or `4`; `frequency` admits only 1, 2 and 4; dates and\n`basis` are truncated to integers.\n\nThe day-count basis values are the standard five: `0` or omitted = US (NASD) 30/360, `1` =\nActual/actual, `2` = Actual/360, `3` = Actual/365, `4` = European 30/360.\n\nBecause the extra division uses `yld/frequency`, the `frequency` argument enters the answer twice —\nonce through the coupon schedule and once through the divisor. Getting it wrong therefore moves the\nresult further than it moves `DURATION`.\n\n\n"
  },
  "signature": {
    "display": "MDURATION(settlement, maturity, coupon, yld, frequency, [basis])",
    "parameters": [
      {
        "description": null,
        "name": "settlement",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "maturity",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "coupon",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "yld",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "frequency",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "basis",
        "optional": true,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 6,
        "min": 5
      },
      "category": "Financial functions",
      "classification": {
        "arg_preparation_profile": "ValuesOnlyPreAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "None",
        "host_interaction_class": "None",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": "Modified duration of a security with periodic coupons",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns the Macauley modified duration for a security with an assumed par value of $100",
        "microsoft_url": "https://support.microsoft.com/en-us/office/mduration-function-b3786a69-4f20-469a-94ad-33e5b90a763c"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "MDURATION"
        },
        {
          "locale": "bg-BG",
          "name": "MDURATION"
        },
        {
          "locale": "cs-CZ",
          "name": "MDURATION"
        },
        {
          "locale": "da-DK",
          "name": "MVARIGHED"
        },
        {
          "locale": "de-DE",
          "name": "MDURATION"
        },
        {
          "locale": "el-GR",
          "name": "MDURATION"
        },
        {
          "locale": "en-AU",
          "name": "MDURATION"
        },
        {
          "locale": "en-GB",
          "name": "MDURATION"
        },
        {
          "locale": "en-US",
          "name": "MDURATION"
        },
        {
          "locale": "es-ES",
          "name": "DURACION.MODIF"
        },
        {
          "locale": "et-EE",
          "name": "MDURATION"
        },
        {
          "locale": "fi-FI",
          "name": "KESTO.MUUNN"
        },
        {
          "locale": "fr-FR",
          "name": "DUREE.MODIFIEE*"
        },
        {
          "locale": "he-IL",
          "name": "MDURATION"
        },
        {
          "locale": "hr-HR",
          "name": "MDURATION"
        },
        {
          "locale": "hu-HU",
          "name": "MKAMATÉRZ"
        },
        {
          "locale": "id-ID",
          "name": "MDURATION"
        },
        {
          "locale": "it-IT",
          "name": "MDURATION"
        },
        {
          "locale": "ja-JP",
          "name": "MDURATION"
        },
        {
          "locale": "ko-KR",
          "name": "MDURATION"
        },
        {
          "locale": "lt-LT",
          "name": "MDURATION"
        },
        {
          "locale": "lv-LV",
          "name": "MDURATION"
        },
        {
          "locale": "nb-NO",
          "name": "MVARIGHET"
        },
        {
          "locale": "nl-NL",
          "name": "AANG.DUUR"
        },
        {
          "locale": "pl-PL",
          "name": "ROCZ.PRZYCH.M"
        },
        {
          "locale": "pt-BR",
          "name": "MDURATION"
        },
        {
          "locale": "pt-PT",
          "name": "MDURAÇÃO"
        },
        {
          "locale": "ro-RO",
          "name": "MDURATION"
        },
        {
          "locale": "ru-RU",
          "name": "МДЛИТ"
        },
        {
          "locale": "sk-SK",
          "name": "MDURATION"
        },
        {
          "locale": "sl-SI",
          "name": "MDURATION"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "MDURATION"
        },
        {
          "locale": "sv-SE",
          "name": "MLÖPTID"
        },
        {
          "locale": "th-TH",
          "name": "MDURATION"
        },
        {
          "locale": "tr-TR",
          "name": "MSÜRE işlevi"
        },
        {
          "locale": "uk-UA",
          "name": "MDURATION"
        },
        {
          "locale": "vi-VN",
          "name": "MDURATION"
        },
        {
          "locale": "zh-CN",
          "name": "MDURATION"
        },
        {
          "locale": "zh-HK",
          "name": "MDURATION"
        },
        {
          "locale": "zh-TW",
          "name": "MDURATION"
        }
      ],
      "signature": {
        "display": "MDURATION(settlement, maturity, coupon, yld, frequency, [basis])",
        "parameters": [
          {
            "description": null,
            "name": "settlement",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "maturity",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "coupon",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "yld",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "frequency",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "basis",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "MDURATION",
      "version_marker": null,
      "xlcall": {
        "code": "459",
        "symbol": "xlfMduration"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/mduration-function-b3786a69-4f20-469a-94ad-33e5b90a763c"
  },
  "try_it": {
    "formula": "=MDURATION(DATE(2024,1,1),DATE(2028,1,1),0.05,0.06,2)"
  },
  "url": "https://handbook.dnacalc.com/functions/MDURATION.html",
  "variants": [],
  "versions": [
    {
      "behaviour": "1,260 captured inputs are indexed for this environment. Capture dates: 2026-07-20 to 2026-07-20. This is a reading count, not a comparison with another build.",
      "excel_build": "16.0 build 20131",
      "platform": "Windows, bitness not recorded, AMD Ryzen 7 4800H with Radeon Graphics",
      "sources": [
        "https://github.com/DnaCalc/ExcelFunctionsHandbook/blob/5dc75391aa5125ccc5abdb095da85950980d6fd8/content/evidence/environments/FUNC.MDURATION.json"
      ]
    }
  ]
}