Count Occurrences Of A Word In A Document

3
Count Occurrences Of A Word In A Document
Word 2007 might show a live word count on the screen, but what if you want to find out how many instances there are of a single word? There’s no built-in solution, but you can solve the problem with a simple hack.

I was faced with this problem recently when trying to find how many double discs there were in a list of ripped CDs. I knew each one had the annotation ‘2CD’, but how many were there in the document? Word’s own help didn’t offer any solace, but a bit of digging soon found a fix courtesy of Tips.Net.

The solution in a nutshell? Do a Replace All for the item you’re trying to count, and replace it with the special character ^&, which tells Office to replace the searched item with itself, leaving the document unchanged. At the end of the exercise, Word reports the number of items it has replaced, which equates to the number of occurrences.

You could also get the same result by simply replacing something with itself, but this option minimises the risk of a typo in the replace field unexpectedly altering your document. Hit the Tips.net post for some useful macro code if you regularly face this kind of situation.

Generating a Count of Word Occurrences [Tips.Net]

Comments

Show more comments

Log in to comment on this story!