7

I know it is possible to add a word count field (NUMCOUNT) to a document to create a dynamic word count, but is it possible to limit the word count to only a section of the document?

I need a solution which does not use Macros/VBA.

6
  • 1
    There is no per-section Word count field. The only way I could imagine doing this without VBA etc. would be to have each section in a separate file with a { NUMWORDS }, update each of those fields and lock the result, then combine the sections. And that would probably require a macro to do it reliably...
    – user181946
    Nov 5, 2015 at 19:32
  • Considering how far the Office suite has developed it surprises me that some features are still quite basic. Nov 6, 2015 at 0:03
  • 2
    Yes, fields have seen very little development (except in the sense that there are now also content controls, but they are not treated equally across the various platforms). IMO it would not have taken much to have a "bookmark" parameter for the { NUMWORDS } field, for example - how many words 'covered' by bookmark "abc". I always had the impression that the Word dev. people thought VBA coding could and would replace all that stuff (which of course, it can't) but who knows?
    – user181946
    Nov 7, 2015 at 10:23
  • 1
    FWIW, you can subtract a constant from NUMWORDS if the word count outside the section of interest isn't changing. E.g., { = { NUMWORDS } - 8 }. Use Ctrl+F9 to produce braces, not Shift+[. Jan 8, 2017 at 3:10
  • Here's a hacky solution: superuser.com/a/188471/156700
    – JohnLBevan
    Jan 23, 2019 at 19:38

3 Answers 3

2
+50

Loosening the VBA restrictions, the macro found on wordribbon.tips.net can calculate the number of words per section, given that each section is followed by a section break:

Sub WordCount()
    Dim NumSec As Integer
    Dim S As Integer
    Dim Summary As String

    NumSec = ActiveDocument.Sections.Count
    Summary = "Word Count" & vbCrLf

    For S = 1 To NumSec
        Summary = Summary & "Section " & S & ": " _
          & ActiveDocument.Sections(S).Range.ComputeStatistics(wdStatisticWords) _
          & vbCrLf
    Next

    Summary = Summary & "Document: " & _
      ActiveDocument.Range.ComputeStatistics(wdStatisticWords)
    MsgBox Summary
End Sub

Note that I replaced .Words.Count with .ComputeStatistics(wdStatisticWords) for a more accurate count (based on the information in this KB article).

The current macro will show an alert with the word count per section, but of course this information can be stored as text in the document as well.

0

Finding the word-count of a section of the document:

  • Select the section of interest
  • Position to the Review pane
  • In the Proofing group, click on Word Count:

enter image description here

3
  • This doesn't answer the question. The op want to insert in the document a field where the word count of the current section is displayed
    – Butanium
    Jan 23, 2022 at 17:07
  • @Butanium: In this case the answer would have been negative - this is not possible without VBA.
    – harrymc
    Jan 23, 2022 at 17:17
  • Oh sorry I'll repost the question with macro allowed. superuser.com/questions/1701062/…
    – Butanium
    Jan 24, 2022 at 15:07
-1

When you select the section, just look at the status bar. The word count is shown there.

Word count shown on the status bar

1
  • This doesn't answer the question. The word count has to be in the document.
    – Butanium
    Jan 23, 2022 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .