Array Transformation functions

ARCLS

Reference

» Reference, Discussion, & Example Applications:

About

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

Inputs:

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

Code

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