我想计算一个字符串在 Google 表格中的单个单元格中出现的次数。
如果我有
599^612
600
601^602^604
44^56^71^83^95^107^119^131^402^451^466^478^490^502^514^571^633^648^661^680^746^813^878^945^1010^1069^1100^1131^1161^1226^1247^1258
我想获得每一行中 ^ 的计数。
Cell | Count
599^612 | 2
600 | 1
601^602^604 | 3
44^56^71^83^95^107^119^131^402 | 9
我尝试过查找、计数和计数,但无法解决。还审核了 Count the number occurrences of a character in a string,但需要在 Google 表格中找到解决方案。
答案 0 :(得分:2)
答案 1 :(得分:2)
这可以使用 LEN
和 SUBSTITUTE
函数轻松完成。
=LEN(A2)-LEN(SUBSTITUTE(A2, "^", ""))+1
答案 2 :(得分:1)
我不知道为什么 44^56^71^83^95^107^119^131^402^451^466^478^490^502^514^571^633^648^661^680^746^813^878^945^1010^1069^1100^1131^1161^1226^1247^1258
在 44^56^71^83^95^107^119^131^402
处中断,但您可以这样计算 ^
:
=arrayformula({A1:A,if(A1:A<>"",iferror(len(regexreplace(A1:A,"[^\^]",""))+1,),)})
或者只是计数:
=arrayformula(if(A1:A<>"",iferror(len(regexreplace(A1:A,"[^\^]",""))+1,),))