Reputation: 3
I have a string such as "0000xxx0xxx0xx00xxxxxx0xx0xxxxx" in an Excel Cell
I want to count how many times a sequence of more than three "x" appears, in other words, how many times a sequence such as "xxx" or "xxxx" and so on appears in this cell.
The output would be 4 times for this example.
Upvotes: 0
Views: 122
Reputation: 75840
For the sake of alternatives:
=COUNTA(FILTERXML("<t><s>"&SUBSTITUTE(A1,"0","</s><s>")&"</s></t>","//s[string-length(.)>2]"))
FILTERXML
is available from Excel 2013 onwards (except Excel Online and Excel for Mac).
Upvotes: 3