Document Editing Problems

How to Count Words in Selected Word Table Cells

Amos GikundaAmos Gikunda Oct 29, 2026 869 views

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.

How to Count Words in Selected Word Table Cells
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press 'Alt + F11' on your keyboard to open the Microsoft Visual Basic for Applications (VBA) editor.

2
Insert a New Module

In the top menu, click 'Insert' and select 'Module' to create a blank workspace for your code.

3
Paste the Macro 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.

4
Run the Macro

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'.

Use a VBA Macro to Count Words in Selected Cells
Contiguous Selection Required: This macro works most reliably when the selected table cells are adjacent. Selecting scattered, non-contiguous cells may result in errors or inaccurate counts.
Free Microsoft Office alternative

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.

Fully compatible with Microsoft Word formats (.docx, .doc, .rtf).Free and lightweight, ensuring smooth performance even with multi-page tables.Familiar user interface for a zero-learning-curve transition.Built-in robust text and table management tools for precise document analysis.
microsoft office alternative - wps office

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.