How to Count Words in Selected Parts of a Word Document
Question details
The user wants to count the total words only in specific, designated sections of a Word document while excluding elements like the cover page, headings, and appendices, and dynamically display this total.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Tracking exact word counts for specific document sections without manually highlighting them each time, usually for assignments or professional reports with strict length constraints.
- Observed behavior
- Needs a dynamic, automated method using content controls and document variables to accurately calculate and display the targeted word count on the cover page.
Ensure you have the Developer tab enabled in your Word processor's ribbon, as you will need access to Content Controls and the VBA Editor to automate this process.
Use Content Controls and VBA to Count Specific Sections
Use this method to automatically calculate words from designated text areas and display the result dynamically on a cover page.
By tagging specific content controls and using a simple VBA script, you can exclude unwanted sections (like tables of contents or references) from your total word count.
Navigate to the Developer tab. Insert a Plain Text Content Control on your cover page and assign it the title 'Total'. Then, wrap the specific text sections you want to include in the word count with their own Content Controls.
Select the properties for the Content Controls surrounding your targeted text. Assign the exact tag 'Count' to each of these controls so the macro can identify them.
Press Alt + F11 to open the VBA Editor. Under the 'ThisDocument' module, write a macro that uses the SelectContentControlsByTag("Count") method.
In your script, iterate through the tagged controls and add up each control's Range.Words.Count to get the accurate word total for the designated parts.
Have the macro write the final sum directly into the 'Total' content control. Alternatively, store the result in a document variable and display it on the cover page using a DOCVARIABLE field.

Manually Count Selected Text Sections
Best for quick, one-off word counts without needing to set up Developer tools or VBA macros.
Easily Manage Word Counts in WPS Writer
WPS Office provides an intuitive Word Count tool and supports advanced document fields, making it incredibly easy to track the length of your essays, reports, or selected text sections without complex configurations.
- 1. Open your Document: Launch WPS Writer and open the .docx file you need to analyze.
- 2. Select Specific Sections: Highlight the text you want to count. Hold down the Ctrl key on your keyboard to select multiple non-adjacent paragraphs at once.
- 3. Check the Status Bar: Look at the bottom of the WPS Writer window to instantly view the combined word count for all your highlighted text.
- 4. Use Advanced Word Count: For a deeper breakdown, navigate to the Review tab and click 'Word Count' to see characters, lines, paragraphs, and choose whether to include footnotes.

Frequently Asked Questions
Does the standard word count include footnotes and endnotes?
By default, the status bar word count may not include footnotes and endnotes. You can include them by opening the Word Count dialog box from the Review tab and checking the box for 'Include textboxes, footnotes and endnotes'.
Can I update the DOCVARIABLE field automatically before printing?
Yes, you can ensure your fields are updated automatically. Go to File > Options > Display, and check the box that says 'Update fields before printing'.
Why does my VBA script throw an error when counting words?
This usually happens if macro security settings are restricting execution, or if the designated Content Control tags do not match exactly. Ensure your tag is spelled correctly and matches the exact casing (e.g., 'Count') used in your macro.
How do I count words in multiple non-adjacent sections without macros?
You can hold down the Ctrl key on Windows while highlighting different sections of your document. The status bar at the bottom will automatically calculate and display the combined word count of all the highlighted areas.




