How to Count Words in Selected Word Table Cells
Question details
The user needs a practical way to count the exact number of words within specific selected table cells or columns in Microsoft Word.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Working with large documents containing multi-page tables where manually counting words in entire columns or specific cells is impractical.
- Observed behavior
- Microsoft Word's default word count feature displays the total document word count instead of isolating the count for the selected table cells.
Ensure you have the Developer tab enabled in your Microsoft Word ribbon to access the VBA editor. It is highly recommended to save a backup copy of your document before adding or running new macros.
Use a VBA Macro to Count Words in Selected Cells
Create and run a custom VBA macro that loops through your selected cells and accurately calculates the total word count.
Microsoft Word does not have a built-in feature to isolate word counts for selected table cells directly in the status bar. By using a VBA macro, you can bypass this limitation. The macro iterates through each selected cell and sums up the words.
Note that the VBA word count might slightly differ from the built-in word count tool because VBA includes punctuation marks, paragraph marks, and hidden end-of-cell markers as individual words.
Press 'Alt + F11' on your keyboard to open the Microsoft Visual Basic for Applications (VBA) editor.
In the top menu, click 'Insert' and select 'Module' to create a blank workspace for your code.
Copy and paste the following code into the blank module window: Dim Count As Long Dim i As Long Count = 0 For i = 1 To Selection.Cells.Count Count = Count + Selection.Cells(i).Range.Words.Count Next i MsgBox "The selected cells contain " & Count & " words." Make sure to use 'Selection.Cells(i)' to ensure the loop calculates every cell.
Close the VBA editor. Highlight the specific adjacent table cells or entire columns you want to count in your Word document, then press 'Alt + F8', select your new macro, and click 'Run'.

Copy Selected Cells to a New Document
If you prefer not to use VBA macros, you can use a manual copy-paste workaround to utilize Word's built-in word count feature.
Try WPS Office for Seamless Document Management
If you frequently encounter workflow limitations with Microsoft Word's built-in features, consider switching to WPS Office. It provides a lightweight, free, and highly compatible alternative with intuitive document editing tools designed to boost your productivity without complex workarounds.

Frequently Asked Questions
Why does the VBA macro word count differ from Word's built-in count?
The VBA 'Range.Words.Count' property automatically includes punctuation marks, paragraph marks, and hidden end-of-cell markers in its calculation. Word's built-in word count tool typically excludes these non-text elements, resulting in a slightly lower number.
Can I select non-adjacent table cells to count words with this macro?
The VBA macro method works most reliably when the selected table cells are adjacent. Highlighting non-contiguous cells may cause the loop iteration to fail or return an inaccurate total word count.
Why does the macro code need 'Selection.Cells(i)' instead of 'Selection.Cells(1)'?
Using 'Selection.Cells(1)' contains a bug where the macro repeatedly counts the words in the very first selected cell for every loop iteration. Changing it to 'Selection.Cells(i)' ensures the macro moves to the next cell in your selection during each cycle, providing an accurate total.




