0
votes

How to count how many words more than 2 characters in a range of cells in Excel, we can use below formula to count total number of words with any length with counting the spaces between the words.

=SUM(IF(LEN(TRIM(M3))=0,0,LEN(TRIM(M3))-LEN(SUBSTITUTE(M3," ",""))+1))

But how to sepcify to count only words more than 2 characters.

For below example:

KNPC
Techn. P
16
in / out 
L

It should return only 3 words as word count.

enter image description here

To make sure to count 0 if the cell is empty.

IF(LEN(TRIM(M3))=0,0,COUNTA(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(M3,CHAR(10)," "),"&","&amp;")," ","</s><s>")&"</s></t>","//s[string-length(.)>2]")))
1

1 Answers

1
votes

For example:

enter image description here

Formula in B1:

=COUNTA(FILTERXML("<t><s>"&SUBSTITUTE(TEXTJOIN(" ",,A1:A5)," ","</s><s>")&"</s></t>","//s[string-length(.)>2]"))

Edit: Seems you interested in a singel cell holding words. Therefor the next example:

Formula in B1:

=COUNTA(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1,"&","&amp;")," ","</s><s>")&"</s></t>","//s[string-length(.)>2]"))

enter image description here