简体   繁体   中英

GoogleSheets - Count characters in cell

I have the following cells with emojis.

在此处输入图像描述

As you can see I would like to get the value of these emojis as numeric.

I tried using a regex: =len(regexreplace(A2,"[^\⭐️]",""))

However, I do not get the desired result.

Any suggestions what I am doing wrong? Find below the link to the example spreadsheet:

Link to the Example Spreadsheet

I appreciate your replies!

added formula to your sheet. Please test it out:

=MAKEARRAY(COUNTA(A2:A),1,LAMBDA(r,c,LAMBDA(ax,IF(ax=0,"-",ax))(LEN(REGEXREPLACE(INDEX(A2:A,r),"[^⭐]",""))+ LEN(REGEXREPLACE(INDEX(A2:A,r),"[^½¾]",""))/2)))

- 在此处输入图像描述

ALTERNATE FORMULA

=BYROW(IFERROR(INDEX(SPLIT(REGEXREPLACE(A2:A, "(.)", "$1|"), "|"))),LAMBDA(ax,IF(ax="",,LAMBDA(zx,IF(zx=0,"-",zx))(COUNTIF(ax,"⭐")+COUNTIF(ax,"")+IF((COUNTIF(ax,"½")>0)+(COUNTIF(ax,"¾")>0),0.5,)))))

-

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM