Ryouta11
Ryouta11

Reputation: 69

How do I count emoji and symbols in a cell?

What formula can I use to get a count of emoji and characters in a single cell?

For example, In cells, A1,A2 and A3:

๐Ÿ™Œ๐Ÿ™Œ๐Ÿ™Œ

๐Ÿคœโœ‹๏ธ๐Ÿ‘ˆ๐Ÿคœ๐Ÿคœ

??๐Ÿ‘Š๐Ÿ‘Š๐Ÿ‘Š

Total Count of characters in each cell(Desired Output):

3

5

5

Upvotes: 5

Views: 3185

Answers (2)

Max Makhrov
Max Makhrov

Reputation: 18717

=COUNTA(FILTER( SPLIT(REGEXREPLACE(A1,"(.)","#$1"),"#"), SPLIT(REGEXREPLACE(A1,"(.)","#$1"),"#")<>"" ))

Based on the answer by @I'-'I

Some emojis contain from multiple emojis joined by char(8205):

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆโ€๐Ÿ‘ฆโ€๐Ÿ‘†

enter image description here

The result differs and depends on a browser you use.

I wonder, how do we count them?

Upvotes: 1

TheMaster
TheMaster

Reputation: 50644

For the given emojis, This will work well:

=LEN(REGEXREPLACE(A13,".","."))
  • MID/LEN considers each emoji as 2 separate characters.
  • REGEX will consider them as one.
  • But even REGEX will fail with a complex emoji like this:

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ

This contains a literal man emoji๐Ÿ‘จ, a woman emoji๐Ÿ‘ฉ,a girl emoji๐Ÿ‘ง and a boy emoji๐Ÿ‘ฆ-all joined by a ZeroWidthJoiner. You could even swap the boy for a another girl with this formula:

=SUBSTITUTE("โ€๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ","๐Ÿ‘ฆ","๐Ÿ‘ง")

It'll become like this:

โ€๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ง

Upvotes: 3

Related Questions