Descriptive Statistic & Basic Maths functions
ACOLSTREAK
Reference
» Reference, Discussion, & Example Applications:
About
Extracts information from ASTREAKS. Calls ASTREAKS.
Inputs:
- a : array
- [v] : single value or array of values. if omitted, all unique values of “ar” are considered
- [n] : numeric value streak length / frequency. if omitted max(streak length) or max(frequency) is returned. Which one depends on “lf” argument.
- [lf] : streak length / frequency argument. if omitted, frequencies returned; if 1, streak lengths returned; if n = 0 or omitted, and lf = 2, streak lengths of max frequencies returned
Code
M.S. Excel
ACOLSTREAK = LAMBDA(a, [v], [n], [lf],
LET(
b, ASTREAKS(a, v, 1),
m, MAP(
DROP(b, , 1),
LAMBDA(x,
LET(
f, --TEXTSPLIT(x, ","),
y, MAX(f),
ml, IF(y, COLUMNS(f), 0),
l, SEQUENCE(, ml),
IF(
n,
IF(
lf,
TEXTJOIN(",", , IF(f = n, l, "")),
INDEX(f, n)
),
IF(
lf,
IF(
lf = 1,
ml,
y & ";" &
TEXTJOIN(
",",
,
IF(f = y, l, "")
)
),
y
)
)
)
)
),
e, IFERROR(HSTACK(TAKE(b, , 1), m), 0),
IFERROR(--e, e)
)
);
Feedback
Submit and view feedback