{
  "category": "Logical functions",
  "display_name": "IFERROR",
  "entry_kind": "built_in_function",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.IFERROR",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Recorded: 95 workbook cells.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": true,
    "state": "matches",
    "state_label": "Matches every recorded Excel answer",
    "summary": "Matches all 95 recorded answers",
    "workbook_corpus": {
      "cells": 95,
      "matched": 95
    }
  },
  "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/error_fallback.rs#L33-L44",
        "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/error_fallback.rs#L57-L67"
      ],
      "repository": "https://github.com/DnaCalc/DnaCalc",
      "shared_code": [
        "catalogue/error_fallback::fallback_selected",
        "catalogue/error_fallback::not_scalar"
      ],
      "source": "https://github.com/DnaCalc/DnaCalc/blob/9e1884369a678158dd82d3d74188daf986995e87/crates/calc-func/src/catalogue/error_fallback.rs#L33-L44",
      "state": "matches",
      "suite": null,
      "summary": "Matches all 95 recorded answers"
    }
  ],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.IFERROR.json",
  "name": "IFERROR",
  "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- **`IFNA`** is the surgical version: it masks `#N/A` only and lets every other error through. For\n  lookup formulas this is almost always the right choice, and the pair `IFERROR`/`IFNA` is the\n  clearest \"total versus selective\" contrast in the function library.\n- **`ISERROR`, `ISERR`, `ISNA`** are the inspection functions; `IF(ISERROR(x), y, x)` is the\n  pre-2007 idiom `IFERROR` replaced, and it evaluates `x` twice. `ISERR` is `ISERROR` minus `#N/A`\n  — the same distinction `IFNA` draws, from the other side.\n- **`AGGREGATE`** with the appropriate option skips errors inside an aggregation, which is the\n  aggregate-shaped analogue of masking.\n- **`IF`** returns branch errors verbatim and is the function people wrongly expect to handle\n  errors.\n- `IFERROR` arrived in Excel 2007. Workbooks that must open in Excel 2003 use the double-evaluation\n  `IF(ISERROR(...))` idiom instead; that is a version-compatibility fact, not a\n  Compatibility-category supersession, and Microsoft has not deprecated anything here.\n\n\n",
    "how-to-implement": "\n### Notes for implementers\n\n1. **Test the kind, not the code.** Any per-code logic belongs in `IFNA`, not here. If your\n   `IFERROR` needs a list of error codes, the design has already gone wrong.\n2. **Do not evaluate the fallback eagerly.** The whole point of `IFERROR` over the `ISERROR` idiom\n   is single evaluation of the primary and no evaluation of the fallback when it is not needed.\n3. **Decide the array policy explicitly and write it down.** Elementwise masking and whole-array\n   masking give different answers for any array containing both errors and values, and this is\n   exactly where a dynamic-array-era implementation will diverge from a legacy one.\n\n\n",
    "quirks": "\n### Result and edge cases\n\n\nReturns whatever kind the selected argument carries.\n\n- **Primary is not an error.** Returned verbatim, including text, logicals, and arrays.\n- **Primary is any error.** The fallback is returned, verbatim.\n- **Fallback is itself an error.** Returned as-is. `IFERROR(1/0, NA())` is `#N/A` — the mask does\n  not iterate.\n- **Empty text as the primary.** `IFERROR(\"\", \"\")` is the empty string. Empty text is a perfectly\n  good non-error value.\n- **Arrays.** The function's own classification is surface-native; an array primary containing a\n  mix of errors and values raises the question of whether the mask applies elementwise or to the\n  array as a whole. That question is listed below as unchecked, and it is the most consequential\n  unknown on this page for modern dynamic-array formulas.\n\n\n\n### Errors\n\n\n| Error | Condition |\n|---|---|\n| any error | Only by being returned from `value_if_error`, or by propagating from a failure in preparing the arguments themselves. |\n\n",
    "sources": "- `data/functions/FUNC.IFERROR.json`, `data/presence/FUNC.IFERROR.json`.\n\n\n",
    "version-differences": "No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.",
    "what-it-does": "\n`IFERROR(value, value_if_error)` returns `value` unless `value` is an **error value of any code**,\nin which case it returns `value_if_error`.\n\nThe test is on the *kind* of the value, not on its content: the function asks \"is this an `Error`?\"\nand nothing else. All fourteen worksheet error codes\n([chapter 01](../model/01-value-universe.md)) are masked equally — `#DIV/0!`, `#N/A`, `#VALUE!`,\n`#REF!`, `#NAME?`, `#NUM!`, `#NULL!`, and the extended family alike.\n\nThis is the crucial property and the crucial danger. `IFERROR` is a **total** mask: it cannot\ndistinguish a divide-by-zero you expected from a `#REF!` caused by a deleted column or a `#NAME?`\ncaused by a typo in the very formula it wraps. Wrapping a lookup in `IFERROR` to suppress \"not\nfound\" also suppresses every structural break in that lookup, silently and permanently. `IFNA`\nexists precisely because that trade is usually a bad one.\n\n`IFERROR` is one of the declared exceptions to the engine's universal error-propagation rule: the\ncoercion model states that errors propagate through conversion *unless* a family explicitly\ndeclares branching behaviour, and `IFERROR` is named as such a declaration\n([chapter 02](../model/02-coercion-and-lifting.md), \"Error propagation\").\n\nLike `IF`, it is a lazy selector — the fallback is only reached when the primary is an error.\n\n\n\n### Arguments\n\n\n`IFERROR(value, value_if_error)`\n\n- **`value`** — required. The expression to test. In practice this is the whole formula you wanted\n  to write; `IFERROR` wraps it.\n\n\n"
  },
  "signature": {
    "display": "IFERROR(value, value_if_error)",
    "parameters": [
      {
        "description": null,
        "name": "value",
        "optional": false,
        "repeats": false
      },
      {
        "description": null,
        "name": "value_if_error",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "implemented",
        "reason": null
      },
      "arity": {
        "max": 2,
        "min": 2
      },
      "category": "Logical functions",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "SelectorBranch",
        "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": "The value of an expression, or a fallback when it is an error",
        "short_source": "dna-calc-own"
      },
      "docs": {
        "english_description": "Returns a value you specify if a formula evaluates to an error; otherwise, returns the result of the formula",
        "microsoft_url": "https://support.microsoft.com/en-us/office/iferror-function-c526fd07-caeb-47b8-8bb6-63f3e417f611"
      },
      "entry_kind": "built_in_function",
      "localized_family_names": null,
      "localized_names": [
        {
          "locale": "ar-SA",
          "name": "IFERROR"
        },
        {
          "locale": "bg-BG",
          "name": "IFERROR"
        },
        {
          "locale": "cs-CZ",
          "name": "CHYBHODN"
        },
        {
          "locale": "da-DK",
          "name": "HVIS.FEJL"
        },
        {
          "locale": "de-DE",
          "name": "WENNFEHLER"
        },
        {
          "locale": "el-GR",
          "name": "IFERROR"
        },
        {
          "locale": "en-AU",
          "name": "IFERROR"
        },
        {
          "locale": "en-GB",
          "name": "IFERROR"
        },
        {
          "locale": "en-US",
          "name": "IFERROR"
        },
        {
          "locale": "es-ES",
          "name": "SI.ERROR"
        },
        {
          "locale": "et-EE",
          "name": "IFERROR"
        },
        {
          "locale": "fi-FI",
          "name": "JOSVIRHE"
        },
        {
          "locale": "fr-FR",
          "name": "SIERREUR"
        },
        {
          "locale": "he-IL",
          "name": "IFERROR"
        },
        {
          "locale": "hr-HR",
          "name": "IFERROR"
        },
        {
          "locale": "hu-HU",
          "name": "HAHIBA:"
        },
        {
          "locale": "id-ID",
          "name": "IFERROR"
        },
        {
          "locale": "it-IT",
          "name": "SE.ERRORE"
        },
        {
          "locale": "ja-JP",
          "name": "IFERROR"
        },
        {
          "locale": "ko-KR",
          "name": "IFERROR"
        },
        {
          "locale": "lt-LT",
          "name": "IFERROR"
        },
        {
          "locale": "lv-LV",
          "name": "IFERROR"
        },
        {
          "locale": "nb-NO",
          "name": "HVISFEIL"
        },
        {
          "locale": "nl-NL",
          "name": "ALS.FOUT"
        },
        {
          "locale": "pl-PL",
          "name": "JEŻELI.BŁĄD"
        },
        {
          "locale": "pt-BR",
          "name": "SEERRO"
        },
        {
          "locale": "pt-PT",
          "name": "SE.ERRO"
        },
        {
          "locale": "ro-RO",
          "name": "IFERROR"
        },
        {
          "locale": "ru-RU",
          "name": "ЕСЛИОШИБКА"
        },
        {
          "locale": "sk-SK",
          "name": "Funkcia IFERROR"
        },
        {
          "locale": "sl-SI",
          "name": "IFERROR"
        },
        {
          "locale": "sr-Latn-RS",
          "name": "IFERROR"
        },
        {
          "locale": "sv-SE",
          "name": "OMFEL"
        },
        {
          "locale": "th-TH",
          "name": "IFERROR"
        },
        {
          "locale": "tr-TR",
          "name": "EĞERHATA"
        },
        {
          "locale": "uk-UA",
          "name": "IFERROR."
        },
        {
          "locale": "vi-VN",
          "name": "IFERROR"
        },
        {
          "locale": "zh-CN",
          "name": "IFERROR"
        },
        {
          "locale": "zh-HK",
          "name": "IFERROR"
        },
        {
          "locale": "zh-TW",
          "name": "IFERROR"
        }
      ],
      "signature": {
        "display": "IFERROR(value, value_if_error)",
        "parameters": [
          {
            "description": null,
            "name": "value",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "value_if_error",
            "optional": false,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "IFERROR",
      "version_marker": null,
      "xlcall": {
        "code": "480",
        "symbol": "xlfIferror"
      }
    },
    "microsoft": "https://support.microsoft.com/en-us/office/iferror-function-c526fd07-caeb-47b8-8bb6-63f3e417f611"
  },
  "try_it": {
    "formula": "=IFERROR(1/0,\"fallback\")"
  },
  "url": "https://handbook.dnacalc.com/functions/IFERROR.html",
  "variants": [],
  "versions": []
}