Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Different Use for Word Counts

Hi. I have a comment field and I need to count the words in the field for each record and enter the count in an adjacent new field in the table named comment_wordcount. My search for something like this returns answers I do not want (such as frequency count of specific words, split comment into separate words and count each word).

But what I need is, for example, if I have 2 records, each with the comment field, and the comment for record # 1 is "My dog is 8 and has black and brown short hair." the new field comment_wordcount I create for this table would show the value 11; whereas for record #2 the comment "My black cat likes to bite."  would show the value 6 in the new comment_wordcount field.

Any ideas? Even if you suggest counting the spaces, I would be appreciative. Thanks in advance.

Coleman

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use substringcount like:

=SubstringCount(Comment, ' ')+1

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use substringcount like:

=SubstringCount(Comment, ' ')+1

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
simenkg
Specialist
Specialist

How about something simple like:

SubStringCount(Text,' ')+1

?

Not applicable
Author

Thank you.