{
  "category": "Operators",
  "display_name": "Whitespace around a reference",
  "entry_kind": "built_in_operator",
  "eval_api": {
    "method": "POST",
    "url": "https://handbook.dnacalc.com/api/eval"
  },
  "function_id": "FUNC.OP_TRIM_REF_BOTH",
  "implementation_state": {
    "answer_bank": null,
    "detail": "Handled by the formula layer, which owns references; answers are recorded through whole formulas, not attributed to the operator.",
    "dnacalc_commit": "9e1884369a678158dd82d3d74188daf986995e87",
    "in_catalogue": false,
    "state": "unmeasured",
    "state_label": "Implemented, no recorded answers attributed to it",
    "summary": "Implemented; no recorded answers are attributed to this entry",
    "workbook_corpus": null
  },
  "implementations": [],
  "json_url": "https://handbook.dnacalc.com/api/functions/FUNC.OP_TRIM_REF_BOTH.json",
  "name": "OP_TRIM_REF_BOTH",
  "notes": [],
  "schema": "efh.function-reference/v1",
  "section_order": [
    "what-it-does",
    "try-it",
    "quirks",
    "how-to-implement",
    "version-differences",
    "alternatives"
  ],
  "sections": {
    "alternatives": "\nUse the [range operator](FUNC.OP_RANGE_REF.md) for a rectangular reference, the\n[union operator](FUNC.OP_UNION_REF.md) to combine references, and\n[intersection](FUNC.OP_INTERSECTION_REF.md) to retain their common cells.\n[TRIM](FUNC.TRIM.md) changes text contents rather than parsing formula whitespace.\n\n\n",
    "how-to-implement": "\nRetain whitespace as syntax information until the parser can determine whether it separates two\nreference expressions. When it is padding, keep the operand's reference identity and extent\nunchanged. When it is intersection, construct that reference operation instead.\n\nPreserve the user's formula spelling separately from the evaluated reference. Share the\nlookahead and token classification across the parser and formatter so that saving or displaying\na formula does not reinterpret its spaces. Test padding next to parentheses, commas, range and\nspill operators, plus quoted text containing spaces. Tabs, line breaks and nonbreaking spaces\nneed separate lexical rules; this page does not treat every Unicode space as equivalent.\n\n\n",
    "quirks": "\nWhitespace cannot be discarded blindly before parsing. Excel uses a space between reference\nexpressions for intersection. Confusing that use with padding changes the referenced cells and\ncan introduce `#NULL!` when the intersection is empty.\n\nAn at sign has its own meaning: `@` requests implicit intersection. It is not a general spelling\nfor trimming leading or trailing spaces. Whitespace inside quoted text is data and must not be\nremoved by formula normalization.\n\n\n",
    "sources": "\n- [Microsoft: calculation operators and precedence](https://support.microsoft.com/en-us/excel/calculation-operators-and-precedence-in-excel).\n\n",
    "try-it": "\nCalculate `=SUM( B2 )` with the supplied B2 value. Compare `=SUM(B2)` and\n`=SUM(B2:C3 B3:C4)`: the last formula uses a space as an intersection operator and reads only\nthe cells common to both ranges.\n\n\n",
    "version-differences": "\nNo build-by-build comparison of whitespace normalization is recorded here. Dynamic-array `@`\nnotation is a separate feature with its own compatibility rules.\n\n\n",
    "what-it-does": "\nOrdinary formula whitespace around a reference can be padding. In `=SUM( B2 )`, the padded\nreference still names B2; the surrounding spaces do not change which cell SUM reads.\n\nPadding around one reference must be distinguished from a space joining two reference\nexpressions. The latter can calculate an intersection.\n\n\n"
  },
  "signature": {
    "display": "SUM( reference )",
    "parameters": [
      {
        "description": "A reference surrounded by ordinary formula whitespace.",
        "name": "reference",
        "optional": false,
        "repeats": false
      }
    ],
    "trailing_repeats": false
  },
  "sources": {
    "metadata": {
      "admission": {
        "label": "formula_layer",
        "reason": null
      },
      "arity": {
        "max": 1,
        "min": 1
      },
      "category": "Operators",
      "classification": {
        "arg_preparation_profile": "RefsVisibleInAdapter",
        "coercion_lift_profile": "Custom",
        "determinism_class": "Deterministic",
        "error_collapse_profile": "None",
        "fec_dependency_profile": "RefOnly",
        "host_interaction_class": "WorkbookState",
        "kernel_signature_class": "Custom",
        "rich_value_usage": "RichBlind",
        "surface_fec_dependency_profile": "RefOnly",
        "thread_safety_class": "SafePure",
        "volatility_class": "NonVolatile"
      },
      "descriptions": {
        "long": null,
        "short": null,
        "short_source": "no-short-description"
      },
      "docs": null,
      "entry_kind": "built_in_operator",
      "localized_family_names": null,
      "localized_names": [],
      "signature": {
        "display": "A.:.B",
        "parameters": [
          {
            "description": null,
            "name": "A",
            "optional": false,
            "repeats": false
          },
          {
            "description": null,
            "name": "B",
            "optional": true,
            "repeats": false
          }
        ],
        "trailing_repeats": false
      },
      "surface_name": "OP_TRIM_REF_BOTH",
      "version_marker": null,
      "xlcall": null
    },
    "microsoft": null
  },
  "try_it": {
    "formula": "=SUM( B2 )",
    "inputs": {
      "B2": 1
    }
  },
  "url": "https://handbook.dnacalc.com/functions/OP_TRIM_REF_BOTH.html",
  "variants": [],
  "versions": []
}