Skip to content

ACOMB

>> Reference, Discussion, & Example Applications:

Lists all possible combinations between all unique elements found on each column of an array.

In other words - produces a cartesian product!

A simpler version of ACOMBINE (that takes its data from different columns of a bigger array, calculates unique values by column, and then calculates all combinations)

Does not call any other custom function.

  • ar : array
ACOMB = LAMBDA(ar,
LET(
a, IF(ar = "", "", ar),
r, ROWS(a),
c, COLUMNS(a),
s, SEQUENCE(, c),
q, SEQUENCE(c) ^ 0,
IF(
OR(r = 1, c = 1),
"check array",
LET(
x, MOD(ROUNDUP(SEQUENCE(r ^ c) / r ^ (c - s), 0) - 1, r) + 1,
y, INDEX(a, x, s),
UNIQUE(FILTER(y, NOT(MMULT(--(y = ""), q))))
)
)
)
);