Forum Discussion
Finding Unique Values
- Jul 06, 2024
I'm not a magician, but how about
=LET(v, UNIQUE(TEXTSPLIT(TEXTJOIN(CHAR(10), TRUE, VSTACK(B10:B13)), , CHAR(10))), FILTER(v, ISERROR(SEARCH("Bill No", v))))
KanwalNo1 Here's my take, using a "text to columns" approach:
=LET(
delim, CHAR(10),
arr, delim & TEXTBEFORE(B10:B13, delim, -1) & delim,
cols, SEQUENCE(, MAX(LEN(arr) - LEN(SUBSTITUTE(arr, delim, ))) - 1),
UNIQUE(TOCOL(TEXTBEFORE(TEXTAFTER(arr, delim, cols), delim), 2))
)
The first use of TEXTBEFORE with the [instance_num] set to -1 removes the last line from each cell (Narration line).
The combination of TEXTBEFORE and TEXTAFTER is used to split the data into columns, using CHAR(10) as the delimiter. The width of the resulting array is determined by the item with the greatest number of delimiters. Any items with fewer delimiters than the maximum will be filled with #N/A in their excess columns. TOCOL sends the results to a single column with the errors removed by setting the [ignore] argument to 2 (ignore errors), and UNIQUE returns the final list.