Created
November 27, 2024 18:07
-
-
Save matthews-p/e184c3eef4aee21a4090b2d6de9b3231 to your computer and use it in GitHub Desktop.
DistinctListSort
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** DistinctListSort */ | |
/* | |
FUNCTION NAME: DistinctListSort | |
DESCRIPTION: Given a n-row by 1-column range of concatenated text, | |
returns a n-row by 1-column array of the unique values. Return | |
array is sorted | |
ARGS: | |
rng: Range holding original values | |
delim: Delimiter used to split the concatenated strings | |
col: Column index you want returned (1st column = 1) | |
sortorder: 1 for ascending, -1 for descending | |
EXAMPLE: | |
=DistinctListSort(A1:A1000,"|",4,1) | |
*/ | |
DistinctListSort = LAMBDA( | |
rng, | |
delim, | |
col, | |
sortorder, | |
SORT( | |
UNIQUE( | |
BYROW( | |
rng, | |
LAMBDA( | |
r, | |
INDEX( | |
TEXTSPLIT( | |
r, | |
delim | |
), | |
col | |
) | |
) | |
) | |
), | |
, | |
sortorder | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment