Array Transformation functions

AUNIQUE

Reference

» Reference, Discussion, & Example Applications:

About

Extracts unique values, horizontal (for each row) left aligned , vertical (for each column) top aligned, all (in a vertical array).

Calls AUNQSRT, and AFLAT.

Inputs:

  • a : required array
  • k : required -1 vertical; 0 all vertical; 1 horizontal

Code

M.S. Excel
AUNIQUE = LAMBDA(a, k,
    LET(
        x, OR(k = {-1, 0, 1}),
        af, AFLAT(a, 1),
        au, UNIQUE(FILTER(af, af <> "")),
        IF(
            x,
            SWITCH(k, 0, au, 1, AUNQSRT(a, ), -1, TRANSPOSE(AUNQSRT(TRANSPOSE(a), ))),
            "-1 vert., 0 all vert , 1 horiz."
        )
    )
);