Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Setting Table Values to Three Decimal Places.

Setting Table Values to Three Decimal Places

Written by Allen Wyatt (last updated June 26, 2018)
This tip applies to Word 97, 2000, 2002, and 2003


Jacob has a table containing numeric values pulled from another program. One of the columns has numbers that might be 3.256000 in one cell and 23.200000 in another. He always needs to go through all of these numbers and make them only 3 digits to the right of the decimal point. Jacob wonders if there is a way to automatically step through all the values using a macro and make sure they have only three digits to the right of the decimal point.

This could certainly be done with a macro, but that might not be the best way to do it. The first potential solution is to look at how you are getting your original data. If it is possible, you might want to change the program that generates the data so that it uses only three decimal places. Or, change it so that the data ends up in an Excel worksheet that you can then embed within your Word document.

If that doesn't work, you might be able to modify the program so that it doesn't insert numeric values, but inserts fields that display the numeric values. This may sound confusing, but you can use fields to display only a specific number of digits of a value. This type of field formatting has been discussed in other WordTips.

If you cannot change the way that the original program generates the information that ends up in the table (and most of the time people can't change it), then you can use Find and Replace to limit your values to three decimal places. Follow these steps:

  1. If you want to limit your replace operation to a specific portion of your document (such as a table or a column within a table), select that portion of the document.
  2. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box.
  3. If the More button is visible, click it so that you end up with an expanded dialog box.
  4. Make sure the Use Wildcards check box is selected.
  5. In the Find What box, enter the following: ([0-9].[0-9]{3})[0-9]{1,}
  6. In the Replace With box, enter the following: \1
  7. Click Replace All.

What these steps do is to look for any digit (0 through 9) followed by a decimal point and three digits. This is a "group" (one digit, decimal point, three digits) that must be immediately followed by at least one digit, and perhaps more. When this sequence is found, it is replaced by the first group (one digit, decimal point, three digits). The result is that everything beyond the third digit after the decimal point is chopped off.

This Find and Replace approach is quick and easy, and it doesn't involve the use of macros. It also doesn't round the information that is left in your document. If you need to have the values rounded to three digits instead of cut off at three digits, then you are best to go back to the "see if you can change the originating program" approach discussed at the beginning of this tip.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (575) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Setting Table Values to Three Decimal Places.

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

Converting Strings to Numbers

When creating macros, you often need to convert a text string that contains numbers into actual numeric values. You do ...

Discover More

Automatic Non-breaking Spaces in Dates

It drives some people crazy to have a date break across two lines. If you find yourself in this mindset, then you'll ...

Discover More

Edits Cause Text to Switch to Odd Fonts

If you have problems with strange fonts showing up when you paste information into a document, it is helpful to ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (menu)

Unwanted Numbering on Pasted Tables

When pasting text from another document or from the Web you can have unexpected characters sometimes show up. Many of ...

Discover More

Clearing the Contents of a Table

Want to get rid of information within a table, but not the table itself? Here's a guide to understanding the effects that ...

Discover More

Centering Information in Table Cells

One of the most common ways to format information in a table is to apply some sort of alignment to the contents of table ...

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}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. 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 one minus 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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

Videos
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.