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

Microsoft Word's Amazing Autos (Special Offer)

Microsoft Word's Amazing Autos can help super-charge how you create your documents. Another way you can increase ...

Discover More

Automatically Adding Captions

Word can automatically add captions to various elements of your document, such as tables or figures. Here's how to ...

Discover More

Overriding Automatic Numbering of Tables

Word lets you add automatic numbering to different elements of your document. It does not, however, allow much ...

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 Hidden Text

Word allows you to format text so it can be easily hidden from view and from printing. If you want to convert the hidden ...

Discover More

Replacing with a Subscript

The Find and Replace capabilities of Word are quite powerful. One type of replacing may not seem possible at ...

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
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 three less than 4?

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.