Using CTRL+F indicates the number of occurrences of a search term. However, when using regex (via Find and Replace) there's no indication of count.

Does anyone know how to find the number of occurrences when using regex?


You could try something like this:

=COUNTA(SPLIT(REGEXREPLACE(A1,"something","$ ."),"$"))

This replace the regex pattern your looking for with a symbol, then counts the number of times it occurs in your string, but counting the number of cells it splits into.

note: the extra space and the period at the end of the regexreplace, is there in case your pattern happens to be the last thing in the sentence, or cell value, that way it still has data to split into the final cell.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.