2 Methods to Exclude Table Texts from Word Count Statistics

In today’s post, we are glad to share with you 2 effectual methods to exclude table texts from word count statistics.

Tables are generally used to hold data. And tables are our best friend in illustrating points while working on a document. Then it can get a little awkward when word count is involved. Sometime, we just need to get the number of words of main texts rather than all the data in tables. Yet, it’s known to all that Word counts all words in your document by default. For this reason, we have come up of efficient means. Read on to find out more.Exclude Table Texts from Word Count Statistics

Method 1: Select Tables Manually and Do the Math on Your Own

If it’s a short document with just one or two tables, it’s of no fuss to select tables one by one by holding down “Ctrl” key. In this approach, the total number in selected tables will be visible at the status bar, such as bellow:Number of Words in Selected Tables

As you see, there are 2 numbers. The first refers to the number of words in selected tables while the second is the total number of words in your document. Just use the second number to minus the first one to get the result.

Method 2: Run VBA Codes

As mentioned above, method 1 will be tedious if you have a large number of tables in document. To select them manually is definitely not the ideal way. Instead, we recommend you a macro which will count all words but exclude these in tables and captions.

  1. First and foremost, press “Alt+ F11” to invoke the VBA editor in Word.
  2. Then, click “Normal”.
  3. Next click “Insert” tab.
  4. And choose “Module” on the drop-down menu of “Insert” tab.Click "Normal"->Click "Insert"->Click "Module"
  5. Double click the new module to open the coding area on the right side.
  6. Now paste the following macro there:
Sub ExcludeTableAndCaptionWordsFromWordCount()
  Dim objTable As Table
  Dim objParagraph As Paragraph
  Dim objDoc As Document
  Dim nTableWords As Integer, nDocWords As Integer, nWordCount As Integer, nCaptionWords As Integer
 
  Set objDoc = ActiveDocument
  nTableWords = 0
  nCaptionWords = 0
  nDocWords = ActiveDocument.ComputeStatistics(wdStatisticWords)
 
  With objDoc
    For Each objTable In .Tables
      nTableWords = nTableWords + objTable.Range.ComputeStatistics(wdStatisticWords)
    Next objTable
  End With
 
  With objDoc
    For Each objParagraph In .Paragraphs
      If objParagraph.Range.Style = "Caption" Then
        nCaptionWords = nCaptionWords + objParagraph.Range.ComputeStatistics(wdStatisticWords)
      End If
    Next objParagraph
  End With
 
  nWordCount = nDocWords - nTableWords - nCaptionWords
 
  MsgBox ("There are " & nWordCount & " main text words in this document." & vbCr & "The following items are excluded from word count: " & vbCr & "Total words in tables: " & nTableWords & vbCr & "Total caption words: " & nCaptionWords)
End Sub
  1. Finally, click “Run”.Paste Codes->Click "Run"

Running the macro shall pop up a message box, showing the counting result.The Result Box

Deal with Word Damages

We rely so much on software like Word to process work on daily basis. As a result, we couldn’t bare thinking about the overwhelming consequence of having a Word corruption. You can feel desperate unless you have got a sufficient document repairing tool.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xls fix and pdf repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *