Function computeFillValues

  • Computes the values of a fill (fill handle, Ctrl/⌘+D): count values that continue sourceValues – forward (down/right) or backward (up/left: the value directly in front of the source first).

    source "auto" "alternate"
    one number 5 5, 5, 5 6, 7, 8
    numbers 1, 2 3, 4, 5 (linear; uneven steps: best-fit line) 1, 2, 1
    date 2026-10-14 (Date or ISO text) +1 day each; several dates a month apart: +1 month (month ends stay month ends) copied
    text with a trailing number Item 9 Item 10, Item 11 (leading zeros stay) copied
    anything else repeated: A, B → A, B, A, B repeated

    The type stays: a date text stays a text in the same format, a Date stays a Date, a number written as text stays a text. Decimal noise is rounded (0.1, 0.2 → 0.3, not 0.30000000000000004).

    Parameters

    • sourceValues: unknown[]

      the values of one line (column or row) of the source range, in display order

    • count: number

      the number of values to compute

    • Optional backward: boolean = false

      fill up/left: the values in front of the source, nearest first

    • Optional mode: FillMode = "auto"

    Returns unknown[]

    count values, nearest to the source first

    Example

    computeFillValues([1, 2], 3);                       // [3, 4, 5]
    computeFillValues([5], 3); // [5, 5, 5]
    computeFillValues([5], 3, false, "alternate"); // [6, 7, 8]
    computeFillValues(["2026-10-14"], 2); // ["2026-10-15", "2026-10-16"]
    computeFillValues(["Item 9"], 2); // ["Item 10", "Item 11"]
    computeFillValues([1, 2], 2, true); // [0, -1] (filled upwards)

    Since

    1.1.96