Flagging Incorrect Commas in Numbers

Written by Allen Wyatt (last updated April 12, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365


1

In the reports that Michael prepares, he needs to separate numbers by thousands using commas. He wonders if there is a way to make Word "flag" numbers that have the comma in the wrong place, such as 100,00 or 20,0000.

There is no way to do this automatically within Word. While it might seem that this is something that might be "checkable" by grammar checking, it is not. (I suspect this has to do with the fact that how delimiters like commas are used in numbers can vary wildly based on regional settings in Word.)

One thing you could do is to use the Find and Replace feature in Word to look for incorrect placement of the comma. This can be done with a wild card search, which means that you need to press Ctrl+H and then display the Find tab of the resulting dialog box. Display the options and then make sure the Use Wildcards check box is selected. Here is what you should search for:

(,)([0-9]{1,2})([ .\!\?])

This search pattern looks for thousands groups that are too short, as in 100,00. It looks for a comma followed by either one or two digits and, finally, a space, period, exclamation mark, or question mark.

If you want to search for something that has too many zeroes (such as 20,0000), then you can use the following pattern:

([0-9]{4,})([, .\!\?])

This searches for four or more digits followed by a comma, space, period, exclamation mark, or question mark.

Obviously these two search patterns can be adjusted to better fit the nature of your documents, but they do provide a starting point. For instance, I used earlier in this tip an invalid number surrounded by parentheses (such as 20,0000). The second search pattern won't find this instance because it does look for instances where the number is followed by a closing paren. If you have such numbers in your document, you could adjust the pattern accordingly. Or, you could take a different approach and look for a comma followed by four or more digits:

(,)([0-9]{4,})

Again, the idea is to look at what you have in your document and then develop a search pattern that fits the nature of what you find.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10145) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.

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

Creating a New Toolbar

Excel's interface can be easily modified to reflect the way you want to do your work. This tip explains how you can ...

Discover More

Using TC Fields for Notes

The TC field is normally used in constructing manual Tables of Contents. The way the field works, however, makes it a ...

Discover More

Understanding Variables in VBA Macros

You can create and use all sorts of variables in your macros. This tip examines all the different data types you can specify.

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 365 applications with VBA programming. Written in clear terms and understandable language, the book includes systematic tutorials and contains both intermediate and advanced content for experienced VB developers. Designed to be comprehensive, the book addresses not just one Office application, but the entire Office suite. Check out Mastering VBA for Microsoft Office 365 today!

More WordTips (ribbon)

Replacing Formatting Functions as a Toggle

Sarra is having a problem getting Find and Replace to behave properly when replacing italic-formatted text. This tip ...

Discover More

Replacing Highlighted Words

The Find and Replace capabilities of Word are quite powerful. Knowing how to find and replace highlighted text can be a ...

Discover More

Getting Rid of Trailing Spaces in Footnotes and Endnotes

The Find and Replace tool can get rid of trailing spaces in paragraphs quite nicely. If those spaces are at the end of ...

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 two more than 3?

2025-04-14 11:26:59

Andrew

To “([, .\!\?])” there should probably have a colon, semicolon, and right parenthesis added to account for numbers at the ends of clauses (not just sentences). And there could also be added right square bracket, right curly bracket, right angle bracket, pound sign, percent sign, and hyphen to account for bracketed numbers, pounds, percentages, and ranges.

Another strategy to this problem is to use a “subtractive” approach by highlighting all words consisting of any string of digits, commas, and periods and serially removing the highlighting from any highlighted text consisting of
• a period (decimal point) followed by two (or, if not specifically looking for currency, any number of) digits at the end of a word;
• a comma followed by three digits; and
• 1, 2, or 3 digits at the beginning of a word,
and then examining all remaining highlighted text for the possibility of being part of improperly constructed numbers. Note, there may well be a lot of false positives given that this approach will highlight all or parts of index numbers, page numbers, section numbers, phone numbers, SSN’s, etc., including (or just merely) periods or commas following these kinds of numbers.

Andy,


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.

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.