Dynamic word, table, and figure counts in MS Word

I have been working on a conference paper to be submitted to the Transportation Research Board (TRB) Annual Meeting recently and it is required that the authors add a total word count on the title page.  The way they calculate word count is that, in addition to text count, each table or figure counts as 250 words, and the limit for total word count is 7,500.  I have submitted papers to this meeting before but never spent the time to automate the word count process, but as I was struggling with getting my word count in LaTeX, I finally decide to give it a try in Microsoft Office Word.  I am using Word 2013 for this example, but I believe earlier versions have the exact same function for you to insert dynamic counts.

Let’s assume that you have 4,000 words, 1 tables, and 2 figures.  The expected word count text you want to show on the title page is shown below.  You want to insert and format these four numbers automatically.

4,000 words + 1 table + 2 figures = 4,750 words

Here is a list of things you need to do to achieve that.  (I will also talk about dynamically add date in the document at the end of this article, scroll to the bottom if you are looking for that information)

 

I. Text Count

Adding text count is most straight forward task compared to the other counts.  In MS Word, there is a field name called NumWords which basically is the number of words in the document.  To add this number to your title page, there are at least two ways to do it:

Method #1:  Insert > Quick Parts > Field

In your Word document, go to where you want to insert the word count, then go to the Insert Tab, find the Text Section, select Quick Parts, then Field.  You should get the following window popped up.  On the left panel, select Document Information for Categories and you should be able to see NumWords in the list of field names.  Select it and the Field properties panel should automatically shows up.  Select #.##0 as the numeric format.  Your selections should be exactly the same as those in the the following figure.  Click OK.

Field
Inserting Field to MS Word

What you get is the total text count in the format of ‘x,xxx’.  In this case, 4,000.  As shown in the following figure, if you highlight the text, you should be able to see that the number has a slightly darker background, because it is not a regular text, it is a field object.  If you right click on this field, select Toggle Field Codes, you will get to see what the second method I am going to talk about.  But let’s just stop here for the first method.  (Don’t panic if you toggled the field and see something different and you do not know how to get it back, read on!)

textcnt1
Text count inserted as a MS Field
Method #2:  Ctrl + F9

Instead of clicking around several windows and checkboxes to get the results, one can choose to type in the filed codes directly to insert a field.  This method gives you exactly the same thing you saw in the first method, but it’s more straight forward, probably nerdier.  For example, in your document, go to where you want to insert the text count.  Press Ctrl + F9 on your keyboard, what you see is this:

Insert field using Ctrl+F9
Insert field using Ctrl+F9

Note that darker background shows up again, that means what you see is a field object.  In the field, type NumWords \# “#,##0” \* MERGEFORMAT inside the curly brackets like this:textcnt2

Tip #1:  Be sure to use Ctrl+F9 to generate a field container enclosed in curly brackets, not direct type in the brackets as texts.

Now what you see are just a bunch of codes, it’s okay.  What you need to do is to update the field.  To do so, you can either right click on the field and select Update Field, or just simply select the field (or highlight the whole line) and press F9, and you should get the exact result as the previous method as below.

Text count successfully inserted and updated
Text count successfully inserted and updated

 

II. Figure and Table Counts

Table and figure counts are a little bit trickier to add, but since now you’ve learned how to right field codes in MS Word, you CAN do that.  Now before we start counting the number of figures and tables, you will need to add a field code for each figure and table that you have in your document.  At the end of each figure caption, do the following:

  • Press Ctrl+F9 to insert a field
  • Type in field code SET ft
  • Press Ctrl+F9 again to insert another field inside the current field
  • Type in field code SEQ f

What you see should be like this:

Insert a field for figure count purpose
Insert a field for figure count purpose

This line of field codes basically says that there is a sequence number f, which increases by 1 every time SEQ f gets called, and every time I use this code { SET ft { SEQ f } }, I set the total figure count variable ft to be the value of SEQ f, which increases by 1 every time SEQ f is called.  For the second figure, do the same thing.

Insert the field codes again for each figure
Insert the field codes again for each figure

Tip #2: Note that when you update the filed, the codes you just wrote will not show you anything.  That is normal, because what you did is just set the value of a variable, not calling any field object to be show.  To see field codes again, select the whole caption or select the whole document (Ctrl+A), right click, and select Toggle Field Codes.

Similarly, you can do the same thing by creating another set of variables tt and t for tables.  For example, you can do the following:

  • At the end of each table caption, press Ctrl+F9 to insert a field
  • Type in field code SET tt
  • Press Ctrl+F9 again to insert another field inside the current field
  • Type in field code SEQ t

Finally, to dynamically add table and figure counts to your title page, press Ctrl + F9 to add fields to refer the ft and tt variables.  Type REF ft inside the field where you want to add the figure count; and type REF tt in the field where you want to add the table count.

Insert fields for figure and table counts
Insert fields for figure and table counts

Now what you get is like this:

Updated fields with dynamic word, figure, and table counts added
Updated fields with dynamic word, figure, and table counts added

III. Total Counts

Now that you have all three counts, what you want to do is to dynamically calculate the total word count.  As stated at the beginning of this article, each table and figure accounts for 250 words, so what we want to do is to add a field in which we do the calculation.  In your document, go to where you want to add the total word count, again, press Ctrl + F9 to add a field.  The type of field we are adding is a Formula (in case you want to use the first method mentioned previously).  Type ={NumWords} + {REF tt} * 250 + {REF ft} * 250 into your field container as shown in the following figure.  Note that each pair of brackets in the codes is added by pressing Ctrl + F9.  For clarity, let me break it down as the following steps:

  • Press Ctrl+F9
  • Type =
  • Press Ctrl+F9 again to add the first in-field
  • Type NumWords
  • After the NumWords in-field, type + followed by Ctrl+F9 to insert the second in-field
  • Type REF tt in the second in-field
  • Type * 250 + after the second in-field
  • Press Ctrl+F9 to add the third in-field
  • Type REF ft in the third in-field, followed by * 250
Insert a field with formula to calculate total word count
Insert a field with formula to calculate total word count

Select the whole line and update fields, you will get this:

All four fields are now successfully inserted and updated
All four fields are now successfully inserted and updated

IV. Dynamic Plurality

Note that there is only one table in the above case.  Sometimes you get one table, sometimes you get more than one.  You may ask: “Can I dynamically add “s” if there were more than one table, and use only “table” instead of “tables” if there is only one table?”  The answer is yes and here is how you do it.

  • In your document, go to the end of the word tables
  • Delete the s in “tables”
  • Press Ctrl+F9 to add a field to the right of the letter e, leave no black spaces in between
  • Type IF tt > 1 “s” “” \*MERGEFORMAT
  • Similarly, go to the end of the word figures
  • Delete the s in “figures”
  • Press Ctrl+F9 to add another field
  • Type IF ft > 1 “s” “” \*MERGEFORMAT
Insert a field which returns "s" if plural, and "" if not
Insert a field which returns “s” if plural, and “” if not

What the IF code does is basically verify if the number of table/figure is greater than one, if yes, add an “s”, if no, add nothing.  And these steps should lead you to the following outcome when you update the fields.

Final results of all counts and plurality successfully inserted
Final results with all counts and plurality successfully inserted

V. Dynamic Date

For submission date, press Ctrl+F9 and add field code DATE \@ “MMMM d, yyyy” \* MERGEFORMAT to insert the date.  Note that you may replace \@ “MMMM d, yyyy” with other date format you may want to use.  See the following figure from Quick Parts > Field for possible date formats you can use.  Simply click on the date format you would like and the format syntax will show up in the Date formats textbox.

Insert date from Quick Parts > Field with available formats
Insert date from Quick Parts > Field with available formats

Tip #3: A good habit is to frequently select the whole document (Ctrl+A) and press F9 to constantly update all fields in the document to make sure your dynamic numbers are up-to-date.  You need to do this right before you complete your paper and ready to submit to ensure everything is updated.

final2
An Example of the Dynamic Word Counts Implemented in MS Word

End Notes

Alright, that’s all I have for today.  I hope this is useful for some of you out there trying to get a dynamic word counting document in MS Word.

If you have any similar question that you need help with, please leave a comment below.  Thanks for reading this article!

You may also like

Leave a Reply

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