Skip to content

Instantly share code, notes, and snippets.

@matthews-p
Last active November 29, 2024 19:42
Show Gist options
  • Save matthews-p/43f85f18c8dff02e4c8bd7eea59ea1fa to your computer and use it in GitHub Desktop.
Save matthews-p/43f85f18c8dff02e4c8bd7eea59ea1fa to your computer and use it in GitHub Desktop.
DistinctList
/** DistinctList */
/*
FUNCTION NAME: DistinctList
DESCRIPTION: Given a n-row by 1-column range of concatenated text,
returns a n-row by 1-column array of the unique values. Not
sorted (use DistinctListSort to get sorted list)
ARGS:
rng: Range holding original values
delim: Delimiter used to split the concatenated strings
col: Column index you want returned (1st column = 1)
EXAMPLE:
=DistinctList(A1:A1000,"|",4)
*/
DistinctList = LAMBDA(
rng,
delim,
col,
UNIQUE(
BYROW(
rng,
LAMBDA(
r,
INDEX(
TEXTSPLIT(
r,
delim
),
col
)
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment