This Microsoft documentation link can help you out with multiple variations of what you're trying to achieve - https://learn.microsoft.com/en-us/office/troubleshoot/excel/formulas-to-count-occurrences-in-excel
To count the occurrences of a substring in a range of cells, you can use this:
SUM(LEN(range)-LEN(SUBSTITUTE(range,"text","")))/LEN("text")
If the above does not work for you you can try this:

Numbers:

To count the occurrences of a substring in one cell, a combination of formulas in excel will do the trick.
Short answer (just plug in your specific text or cell references into this):
=(LEN("original_text")-LEN(SUBSTITUTE("original_text","text_to_count","")))/LEN("text_to_count")
Long answer if you're interested:
- SUBSTITUTE(x, y, z) - takes the original text (x) and the text you want to find (y) and replaces all occurrences of y in x with z and returns the string. In your case (I've chosen a smaller string for brevity):
=SUBSTITUTE("123331<br>asdsdas <br>","<br>","")
This will substitute all occurrences of
with an empty string in your original string - 123331asdsdas
- LEN(x) - simply returns length of the x. In your case:
=LEN(SUBSTITUTE("123331<br>asdsdas <br>","<br>",""))
This will return 14 which is the length of 123331asdsdas.
=LEN("123331<br>asdsdas <br>")
which gives you 22.
=LEN("123331<br>asdsdas <br>") - LEN(SUBSTITUTE("123331<br>asdsdas <br>","<br>",""))
which subtracts length of the substituted string from length of the original string giving you 8.
(LEN("123331<br>asdsdas <br>") - LEN(SUBSTITUTE("123331<br>asdsdas <br>","<br>","")))/LEN("<br>")
divides the above answer from the subtraction by the length of your original string, giving you 2.
This is the number of times
occurred in one cell.
- In plain English, we did
(length_of_original_string - length_of_substituted_string)/length_of_string_to_find
which translates to (22-14)/4 = 2
in your case.
*
","")))/LEN("
*
") however it returns 0 – asd213e1 Jul 18 '20 at 16:44