Skip to content

Instantly share code, notes, and snippets.

@ncalm
Last active June 15, 2023 09:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ncalm/25b871891583802739484bd3c39f65d4 to your computer and use it in GitHub Desktop.
Save ncalm/25b871891583802739484bd3c39f65d4 to your computer and use it in GitHub Desktop.
This Excel lambda function creates a simple frequency table for a single-column array
/*
FREQ.SIMPLE
Calculates a simple frequency table of the values in a column
Inputs:
1. data - a single column of data
*/
FREQ.SIMPLE = LAMBDA(data,
LET(
d, INDEX(data,,1),
u, UNIQUE(d),
X, N(u = TRANSPOSE(d)),
Y, SEQUENCE(ROWS(d), 1, 1, 0),
mp, MMULT(X,Y),
c, CHOOSE({1,2}, u, mp),
SORT(c, 2, -1)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment