Please Note: This article is written for users of the following Microsoft Word versions: 2007 and 2010. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Counting Changed Words.

Counting Changed Words

by Allen Wyatt
(last updated October 26, 2015)

13

Steven uses Track Changes in his documents all the time. He needs a way to count only the words that have been changed in a document—those affected by Track Changes.

The answer is that you can sort of get the information you want through the use of the Reviewing Pane. Display the Review tab of the ribbon, then click the Reviewing Pane tool (in the Tracking group). Word displays the Reviewing Pane on-screen, and at the top of the pane is a summary of the revisions made in the document. It shows statistics for the following five changes:

  • Insertions
  • Deletions
  • Moves
  • Formatting changes
  • Comments

These statistics may seem to fit the bill, but you'll remember that I said that they provide "sort of" the information wanted. They fall a bit short if what you really want is a count of changed words. The statistics count changes, not changed words. For instance, if you delete a phrase that consists of multiple words, that edit counts as only a single deletion in the statistics. Similarly, if you add a phrase to your document, that addition counts as a single insertion, even if the insertion contained a complete paragraph.

If you want actual words changed, you are unfortunately out of luck—Word provides no way to get the information desired. You can, however, devise your own macro to determine the desired information. Here's an example:

Sub GetTCStats()
    Dim lInsertsWords As Long
    Dim lInsertsChar As Long
    Dim lDeletesWords As Long
    Dim lDeletesChar As Long
    Dim sTemp As String
    Dim oRevision As Revision
    
    lInsertsWords = 0
    lInsertsChar = 0
    lDeletesWords = 0
    lDeletesChar = 0
    For Each oRevision In ActiveDocument.Revisions
        Select Case oRevision.Type
            Case wdRevisionInsert
                lInsertsChar = lInsertsChar + Len(oRevision.Range.Text)
                lInsertsWords = lInsertsWords + oRevision.Range.Words.Count
            Case wdRevisionDelete
                lDeletesChar = lDeletesChar + Len(oRevision.Range.Text)
                lDeletesWords = lDeletesWords + oRevision.Range.Words.Count
        End Select
    Next oRevision

    sTemp = "Insertions" & vbCrLf
    sTemp = sTemp & "    Words: " & lInsertsWords & vbCrLf
    sTemp = sTemp & "    Characters: " & lInsertsChar & vbCrLf
    sTemp = sTemp & "Deletions" & vbCrLf
    sTemp = sTemp & "    Words: " & lDeletesWords & vbCrLf
    sTemp = sTemp & "    Characters: " & lDeletesChar & vbCrLf
    MsgBox sTemp
End Sub

This macro steps through each change in the current document and separately sums word counts and character counts for both insertions and deletions. The statistics are then presented in a message box. Note that the macro looks at the Words collection for each change in the document. You should understand that the word count, as presented here, is an approximation. This is because of the way that words are counted. For instance, each punctuation mark in an addition is counted as a separate word. This means that a phrase such as "as one can see, this is a great way" would be tallied as ten words instead of nine (the comma counts as a separate word). Further, if the phrase you added included a leading space—which insertions often do—then there would be eleven words tallied for the insertion because of that space.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11484) applies to Microsoft Word 2007 and 2010. You can find a version of this tip for the older menu interface of Word here: Counting Changed Words.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Inserting a Non-Breaking Hyphen

Non-breaking hyphens can come in helpful for some types of writing. They force the words (or characters) on both sides of the ...

Discover More

Missing Left Border

Ever wonder why a border around a graphic doesn't print the way it looks on the screen? There are several ways to add and ...

Discover More

Extra Space after Quotation Mark when Pasting

Have you ever noticed how Word can decide to add extra spaces when you paste information into your document? This is part of ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Showing Only Added Text with Track Changes

Do you want to change how Track Changes displays the markup in your document? Here's how you can completely hide deleted text ...

Discover More

Using Track Changes

Track Changes is a valuable Word tool that allows you to automatically mark changes in your document. This is a great boon ...

Discover More

Using Different Colors with Tracked Changes

When changes are made in a document with Track Changes turned on, each author's changes are normally shown in a different ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 - 2?

2017-02-21 12:56:48

Yann

Nice. Thanks for this Allen.
Cheers
Yann


2016-04-11 14:36:06

How can count revision by author

Wow can I track revisions and conting by author?
Tnx


2016-02-08 17:15:38

Hollee

In case someone comes across this years later, I also got "Run-time error (5852): Requested object is not available." with debug showing the code stops at -> Select Case oRevision.Type and was able to solve it by removing hyperlinks from the document. To do this, select the entire document and Ctrl+Shift+F9, then run the macro again. Hope it works for you too!


2015-11-12 22:39:53

V.S.Rawat

Worked perfectly well as described and so fast.

Thanks for the great help.
--
Rawat


2015-05-16 02:27:32

Pallathupady

I regularly work with folders containing Microsoft Word documents with tracked changes.

Would be great if someone could help create a VBA macro in Microsoft Excel that extracts the Revision Summary (just the values/totals) of all Word documents in a particular folder in an Excel work book.

The table should contain
Document name:
Summary (revisions):
Insertions:
Deletions:
--------------


2015-04-07 21:52:11

Ganba Sanz

I am trying above macro for inserted characters count in a word document. Getting Run-time error (5852): Requested object is not available. Debug shows the code stops at -> Select Case oRevision.Type

What could be wrong? Please advise


2014-10-03 10:21:28

D.

This is silly. Just use the review pane in newer versions of Word. It shows you the total count for deletions, insertions, and combined changes.


2014-07-18 05:38:02

Miha Jesenko

You have to set TrackRevisons to true.

ActiveDocument.TrackRevisions = True


2013-03-27 11:12:15

Jessica Weissman

Didn't give me the error in Word 2007. Make sure oRevision is defined as shown in the sample code.


2013-03-27 05:46:03

Jessica Weissman

First, what version of Word?

Second, does this happen on the first revision, or does it do some first?

You could tell by adding a counter, or by looking at the variable values in Debug.


2013-03-26 15:32:54

Kathryn Robyn

That would be Debug, of course!


2013-03-26 15:30:35

Kathryn Robyn

This would be great if it worked. I'm getting this error:
Run-time error '5852':
Requested object is not available.

Clicking Degung takes me to this highlighted line:
Select Case oRevision.Type

So, what do I do now?


2012-03-26 08:17:33

Jessica Weissman

Counting the words and characters in each revision object is ingenious, but there is a philosophical or logical problem. If I replace the word "many" with the word "lots", have I changd one word or two? This macro would call it two, one for the deletion and one for the insertion.

- Jessica


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.