Reputation: 45
I have a text in cell (A1) like this: ✌😋👅👅☝️😉🍌🍪💧💧
I want to extract the unique emojis from this cell into separate cells: ✌😋👅☝️😉🍌🍪💧
Is this possible?
Upvotes: 2
Views: 525
Reputation: 18717
Appears, one of the best formula solutions would be:
=SPLIT(REGEXREPLACE(A1,"(.)","$1@"),"@")
You may also add some additional checks like skin tones & intermediate chars:
=TRANSPOSE(SPLIT(REGEXREPLACE(A2,"(.[🏻🏼🏽🏾🏿"&CHAR(8205)&CHAR(65039)&"]*)","@$1"),"@"))
It will help to join some emojis as a single emoji.
More precise way is to use the script:
https://github.com/orling/grapheme-splitter/blob/master/index.js
↑
function splitEmojis(string) {
var splitter = new GraphemeSplitter();
// split the string to an array of grapheme clusters (one string each)
var graphemes = splitter.splitGraphemes(string);
return graphemes;
}
Please note: some emojis are not correctly shown in sheets
🏴🏴🏴🏴
↑ emojis:
are the same for Google Sheets.
Vlookup function in #GoogleSheets and in #Excel thinks chars
are the same!
Upvotes: 0
Reputation: 201533
✌😋👅👅☝️😉🍌🍪💧💧
to each cell by splitting using the built-in function of Google Spreadsheet.=SPLIT(REGEXREPLACE(A1,"(.)","$1@"),"@")
✌😋👅👅☝️😉🍌🍪💧💧
is put in a cell "A1".REGEXREPLACE
, @
is put to between each character like ✌@😋@👅@👅@☝@️@😉@🍌@🍪@💧@💧@
.SPLIT
, the value is splitted with @
.️
which cannot be displayed is included. It's \ufe0f
. So "G1" can be seen like no value. But the value is existing. So please be careful this. If you want to remove the value, you can use ✌😋👅👅☝😉🍌🍪💧💧
.From marikamitsos's comment, I could notice that my understanding was not correct. So the final result is as follows. This is from marikamitsos.
=TRANSPOSE(UNIQUE(TRANSPOSE(SPLIT(REGEXREPLACE(A1,"(.)","$1@"),"@"))))
Upvotes: 4
Reputation: 1
or try:
=TRANSPOSE(UNIQUE(TRANSPOSE(REGEXEXTRACT(A1, REPT("(.)", LEN(A1))))))
Upvotes: 0