I have a cell in a Google Sheet containing a single word. Let's say that word is TRILLION
.
I want to obtain the set of letters in the word, in order of first appearance. For that word, the answer would be TRILON
(suppressing the double L
and second I
).
I can get the string into array form easily enough with SPLIT(REGEXREPLACE(".", "$0 "), " ")
. Then I'm stuck.
I've tried UNIQUE
, but this fails on unsorted arrays. I've tried SORT
, but this does not appear to work on arrays in Google Sheets, contrary to the documentation's claims (the array remains unsorted)—plus I want the letters in the original order.
What I ultimately want is for each cell in a horizontal range to contain one letter from the original word, in the order of those letters' first appearances in the word.
The formula needs to continue to work even after the word is changed to a different one. (The spreadsheet will be used for a certain word puzzle and I want to be able to duplicate a template sheet for each word players try to work on.)
I have a cell in a Google Sheet containing a single word. Let's say that word is TRILLION
.
I want to obtain the set of letters in the word, in order of first appearance. For that word, the answer would be TRILON
(suppressing the double L
and second I
).
I can get the string into array form easily enough with SPLIT(REGEXREPLACE(".", "$0 "), " ")
. Then I'm stuck.
I've tried UNIQUE
, but this fails on unsorted arrays. I've tried SORT
, but this does not appear to work on arrays in Google Sheets, contrary to the documentation's claims (the array remains unsorted)—plus I want the letters in the original order.
What I ultimately want is for each cell in a horizontal range to contain one letter from the original word, in the order of those letters' first appearances in the word.
The formula needs to continue to work even after the word is changed to a different one. (The spreadsheet will be used for a certain word puzzle and I want to be able to duplicate a template sheet for each word players try to work on.)
Share Improve this question edited Nov 19, 2024 at 21:29 BigBen 50.2k7 gold badges28 silver badges44 bronze badges asked Nov 19, 2024 at 21:29 Peter HoseyPeter Hosey 96.4k15 gold badges213 silver badges372 bronze badges 1- 1 @ScottCraner I tried and it works! Why not post it as an answer? – Lime Husky Commented Nov 19, 2024 at 21:43
1 Answer
Reset to default 2UNIQUE's second argument is whether it should look across columns instead of down a row. Since the SPLIT is returning a horizontal array we need to make that TRUE:
=CONCATENATE(unique(SPLIT(REGEXREPLACE(A1,".", "$0 "), " "),1))
Now it works:
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742397253a4436200.html
评论列表(0条)