{
  "id": "range",
  "version": "af28a6a43453",
  "status": "published",
  "name": "Range Calculator",
  "question": "What is the range of my data?",
  "summary": "Finds the range of a list of numbers, the largest value minus the smallest, with the smallest, the largest, the midrange and the sorted list.",
  "category": "statistics",
  "subcategory": "descriptive",
  "url": "https://www.acalculator.org/statistics/range-calculator",
  "markdown": "https://www.acalculator.org/statistics/range-calculator.md",
  "kind": "function",
  "method": "range = largest − smallest; midrange = (smallest + largest) ÷ 2, in exact decimals.",
  "assumptions": [
    "Every number in the list counts, including repeats.",
    "Numbers are read as the exact decimals typed, so the range has no rounding error.",
    "The list holds 1 to 10,000 numbers."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "data": {
        "title": "Your numbers",
        "description": "The data set: numbers separated by commas, spaces, semicolons or new lines.",
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    }
  },
  "outputs": {
    "range": {
      "label": "Range",
      "description": "The largest value minus the smallest value.",
      "format": "number"
    },
    "min": {
      "label": "Smallest value",
      "description": "The minimum of the list.",
      "format": "number"
    },
    "max": {
      "label": "Largest value",
      "description": "The maximum of the list.",
      "format": "number"
    },
    "midrange": {
      "label": "Midrange",
      "description": "Halfway between the smallest and the largest value: (smallest + largest) ÷ 2.",
      "format": "number"
    },
    "count": {
      "label": "Count",
      "description": "How many numbers are in the list.",
      "format": "integer"
    },
    "sorted": {
      "label": "Sorted list",
      "description": "The numbers from smallest to largest, as stored (up to 200 shown).",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "data": "7, 2, 10, 4, 9, 3"
    },
    "outputs": {
      "range": 8,
      "min": 2,
      "max": 10,
      "midrange": 6,
      "count": 6,
      "sorted": "2, 3, 4, 7, 9, 10"
    },
    "text": "The range of your 6 numbers is 8: from 2 to 10."
  },
  "examples": [
    {
      "given": {
        "data": [
          7,
          2,
          10,
          4,
          9,
          3
        ]
      },
      "expect": {
        "range": 8,
        "min": 2,
        "max": 10,
        "midrange": 6,
        "count": 6,
        "sorted": "2, 3, 4, 7, 9, 10"
      },
      "source": "hand calculation in content.mdx: 10 − 2 = 8; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.6 Measures of Scale: the range is the largest value minus the smallest value (https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm, retrieved 2026-10-02)"
    },
    {
      "given": {
        "data": [
          -4.5,
          12,
          0,
          3.25
        ]
      },
      "expect": {
        "range": 16.5,
        "min": -4.5,
        "max": 12,
        "midrange": 3.75
      },
      "source": "hand calculation in content.mdx: 12 − (−4.5) = 16.5; (12 − 4.5) ÷ 2 = 3.75; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.6 Measures of Scale: the range is the largest value minus the smallest value (https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm, retrieved 2026-10-02)"
    },
    {
      "given": {
        "data": [
          0.1,
          0.3,
          0.2
        ]
      },
      "expect": {
        "range": 0.2,
        "midrange": 0.2
      },
      "source": "hand calculation in content.mdx: 0.3 − 0.1 = 0.2 exactly; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.6 Measures of Scale: the range is the largest value minus the smallest value (https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm, retrieved 2026-10-02)"
    },
    {
      "given": {
        "data": [
          42
        ]
      },
      "expect": {
        "range": 0,
        "min": 42,
        "max": 42,
        "midrange": 42
      },
      "source": "hand calculation in content.mdx: one value is both the smallest and the largest; NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.6 Measures of Scale: the range is the largest value minus the smallest value (https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm, retrieved 2026-10-02)"
    }
  ],
  "sources": [
    "NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.6 Measures of Scale (range = largest value − smallest value), retrieved 2026-10-02. https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm"
  ],
  "related": [
    "mean-median-mode",
    "standard-deviation",
    "quartile",
    "variance"
  ],
  "changelog": []
}
