Resources

Count the characters and words in text strings

Counting the number of characters or words in a string is useful for various reasons. You might be conducting text-based analysis, language processing tasks, or planning social media posts.

In the example, a table houses a list of hotel reviews in A2:A18. How do we find the character and word count of each one?

Character Count

The LEN function returns the number of characters in a text string, so it's a straightforward task of referencing the reviews range inside.

=𝙻𝙴𝙽(π™°πŸΈ:π™°πŸ·πŸΎ)

Word Count

The formula required is best understood broken down. Let's use the review in A2 for the example: "The room was clean and comfortable."

1.

In E2, use TRIM to remove any excess spaces from the string (there aren't any in this case).

=πšƒπšπ™Έπ™Ό(π™°πŸΈ)
The room was clean and comfortable.

2️.

In F2, use SUBSTITUTE to swap each space for an empty string, therefore removing all spaces.

=πš‚πš„π™±πš‚πšƒπ™Έπšƒπš„πšƒπ™΄(π™°πŸΈ," ","")
Theroomwascleanandcomfortable.

3️.

In G2, subtract the character length of the string 𝘸π˜ͺ𝘡𝘩𝘰𝘢𝘡 spaces from the string 𝘸π˜ͺ𝘡𝘩 spaces.

=𝙻𝙴𝙽(π™΄πŸΈ)-𝙻𝙴𝙽(π™΅πŸΈ)
35 – 30 = 5

4️.

Add 1 to include the word after the final space.

=𝙻𝙴𝙽(π™΄πŸΈ)-𝙻𝙴𝙽(π™΅πŸΈ)+𝟷
6

Put together, this is the final formula for retrieving the word count of each review:

=𝙻𝙴𝙽(πšƒπšπ™Έπ™Ό(π™°πŸΈ:π™°πŸ·πŸΎ))
-
𝙻𝙴𝙽(πš‚πš„π™±πš‚πšƒπ™Έπšƒπš„πšƒπ™΄(π™°πŸΈ:π™°πŸ·πŸΎ," ",""))
+𝟷

For more Excel tips and tricks like this, check out our Video Tutorials page.

Andrew Moss
About the Author

Andrew Moss

Andrew is a technical writer who specialises in Microsoft Excel and data analysis. He has published hundreds of articles and social media posts aimed at helping people enhance their skills and spreading good practices.

Conversation

0 Comments

As you comment, let's keep the discussion friendly and respectful to add value to the conversation.

Thank you! Your comment has been sent!
Oops! Something went wrong while submitting the form.
Commenter profile pic.
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Reply
Delete
Commenter profile pic.
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Reply
Delete

Get Tickets

Benefit from an award-winning 3-day conference plus access to exclusive networking and additional Masterclass events.

Get Tickets
Close Cookie Popup
Cookie Preferences
By clicking β€œAccept All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts as outlined in our privacy policy.
Strictly Necessary (Always Active)
Cookies required to enable basic website functionality.
Cookies helping us understand how this website performs, how visitors interact with the site, and whether there may be technical issues.
Cookies used to deliver advertising that is more relevant to you and your interests.
Cookies allowing the website to remember choices you make (such as your user name, language, or the region you are in).