Word formula

  • Thread starter Thread starter Neil
  • Start date Start date
N

Neil

Hi, I have a word document with a variety of tables in it. I am trying to
count the number of times a string of letters appear. In excel I would simply
select the field and use the countif, but can't do this in word! Can anyone
help please?
 
Neil said:
Hi, I have a word document with a variety of tables in it. I am
trying to count the number of times a string of letters appear. In
excel I would simply select the field and use the countif, but can't
do this in word! Can anyone help please?

If it's Word 2003 or 2007 (maybe XP, I don't remember), you can use the Find
dialog. Put the string of letters in the Find What box and check the option
for "Highlight all items found". Click the Find All button. It will tell you
how many instances it found.

If your version of Word doesn't have the "Highlight all items found" option,
you can simulate it by using the Replace tab of the dialog. Put the string
in the Find What box, and put the code ^& in the Replace With box (that
code means "replace with the same text that was found"). Click the Replace
All button, and you'll get the number of replacements that were made.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
thanks, but i'd like tihe total displayed in the word document so other users
can dynamically see the results, by the way it's office 2003, windows XP
 
Sometimes you just can't get what you want. Word really doesn't have
anything like Excel's countif function.

You can type the number from the Find into the document, and redo it
when necessary. Or you can write a macro to count the occurrences (as
in http://www.word.mvps.org/FAQs/MacrosVBA/NoTimesTextInDoc.htm) and
place the result into a document property, which can then be displayed
by a DocProperty field. You'd also need a toolbar button or keyboard
shortcut to run the macro, or write the macro so it intercepts a
built-in command such as Print or Save
(http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top