Array Transformation functions

AUNSTACK

Reference

» Reference, Discussion, & Example Applications:

About

Unstacks an array for a certain height [h].

Code

M.S. Excel
AUNSTACK = LAMBDA(a, [h],
    LET(
        x, ROWS(a),
        y, COLUMNS(a),
        k, MEDIAN(1, ABS(h), x),
        n, ROUNDUP(x / k, 0),
        IFERROR(
            MAKEARRAY(
                k,
                n * y,
                LAMBDA(r, c, INDEX(IF(a = "", "", a), k * QUOTIENT(c - 1, y) + r, MOD(c - 1, y) + 1))
            ),
            ""
        )
    )
);