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

Removing Hyperlinks without a Macro, Take Two

Need to get rid of hyperlinks in a worksheet? Here's an easy way to do it without using a macro.

Discover More

Finding the Lowest Numbers

Need to find the lowest numbers in a range of values? It's easy to do using the SMALL worksheet function, or you can use ...

Discover More

Default Formatting for PivotTables

Wish there was a way to define how you want PivotTables formatted before you actually create the PivotTable? You may be ...

Discover More

Discover the Power of Microsoft Office This beginner-friendly guide reveals the expert tips and strategies you need to skyrocket your productivity and use Office 365 like a pro. Mastering software like Word, Excel, and PowerPoint is essential to be more efficient and advance your career. Simple lessons guide you through every step, providing the knowledge you need to get started. Check out Microsoft Office 365 For Beginners today!

More WordTips (ribbon)

Finding Quoted Text in VBA

Macros are created for all sorts of purposes in creating, editing, and processing documents. You might want to use a ...

Discover More

Using Find and Replace to Change Text Case

Can you really use Find and Replace to change the case of text in your document? Not really, but that shouldn't stop you ...

Discover More

Replacing with Plain Text

When using Find and Replace, how your replacements are formatted will depend on how the text being replaced is formatted. ...

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