Array Transformation functions

ARRWS

Reference

» Reference, Discussion, & Example Applications:

About

Re-arranges rows of an array from left to right in any order.

Inputs:

  • ar : array
  • ns : new sequence order rows (whatever index nr. are left out will be appended at the bottom of the array)

Code

M.S. Excel
ARRWS = LAMBDA(ar, ns,
    LET(
        a, IF(ar = "", "", ar),
        s, SEQUENCE(ROWS(a)),
        h, CHOOSEROWS(s, ns),
        x, XMATCH(s, h),
        f, FILTER(s, ISNA(x)),
        INDEX(a, VSTACK(h, f), SEQUENCE(, COLUMNS(a)))
    )
);