Changing Decimal Commas to Decimal Points

Written by Allen Wyatt (last updated January 21, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


3

Sometimes Flavio has to "localize" scientific text written in Argentina or Spain, which uses decimal commas as delimiters, into "Mexican" Spanish, which uses the decimal point. There are hundreds of such instances where Flavio has to make the change. He wonders if there is a way to use Find and Replace to make such a change.

The short answer is that, yes, there is a way to do this using Find and Replace. How you use Find and Replace to do this, however, depends on the nature of the numbers you are working with.

Many countries use periods and commas in their numbers opposite of the way they are in other countries. For instance, many people will recognize the meaning of numbers such as this:

1,234,567.89

In other countries, however, the number would be shown in this manner:

1.234.567,89

Notice that the purpose of the commas and periods are exactly opposite in these two instances. In one case commas are used as "thousands separators" and in the other as decimal points. In one case the period is used as a decimal point and in the other as a thousands separator.

If your numbers are smaller—under 1,000—you may not need to worry about thousands separators. If this is the case (as it seems to be with Flavio's problem description), then you can use a single wildcard find and replace to do the conversion. Follow these steps:

  1. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box.
  2. Click on the More button if it is available.
  3. Select the Use Wildcards check box.
  4. In the Find What box enter "<([0-9]*),([0-9]*)>", without the quote marks.
  5. In the Replace With box enter "\1.\2", again without the quote marks.
  6. Click on the Replace All button.

The pattern you used in step 4 tells Word that you want to find any number of digits at the beginning of a word (that's what the < character means) followed by a comma and then any number of digits at the end of a word. Note the use of parentheses in the search pattern—they are included so that whatever is found that matches the pattern inside the parentheses can be referenced in the replacement pattern. The preplacement pattern then uses these groups (note there are two sets of parentheses) to say that the first group (\1) should be followed by a period and then the second group (\2).

If your source numbers include periods as thousands separators, then you don't want to do the find and replace as just discussed. If you do, you'll end up with periods in both the thousands separators and the decimal point. Instead, you need to do three individual find and replace operations. In the first one you'll change the thousands separators (the existing periods) to something other than a period or a comma. In the second one you'll change the decimal comma to a decimal point. In the third one you'll then change the "neutral" character you used in the first find and replace to the commas. Here's a way you can do the steps:

  1. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box.
  2. Click on the More button if it is available.
  3. Select the Use Wildcards check box.
  4. In the Find What box enter "([0-9]*).([0-9]*)", without the quote marks.
  5. In the Replace With box enter "\1xyz\2", again without the quote marks. (Note that I'm using the lowercase "xyz" as my neutral delimiter.)
  6. Click on the Replace All button.
  7. In the Find What box enter "([0-9]*),([0-9]*)", without the quote marks.
  8. In the Replace With box enter "\1.\2", again without the quote marks.
  9. Click on the Replace All button.
  10. In the Find What box enter "([0-9]*)xyz([0-9]*)", without the quote marks.
  11. In the Replace With box enter "\1,\2", again without the quote marks.
  12. Click on the Replace All button.

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

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

Reordering the Display of a Data Series

Once you create a chart, you aren't limited to keeping the data series in the order they originally appeared. You can ...

Discover More

Relative VBA Selections

Need to select a cell using a macro? Need that selection to be relative to the cell you currently have selected? Here are ...

Discover More

Calculating Monthly Interest Charges

Trying to calculate how much people owe you? If you charge interest or service charges on past-due accounts, there are a ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Changing Formatting for a Portion of Found Text

The Find and Replace capabilities of Word are quite powerful. If you want to change the formatting of just a part of text ...

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

Counting a Particular Word

Need to know how many times a particular word appears in a document or a portion of a document? Here's a handy trick that ...

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 7?

2024-10-03 06:15:17

Mary

Dear Allen and (commenter) Matt, Bless you both , you saved me from a big trouble. :)


2023-05-31 15:05:05

AC

Very helpful but unfortunately this does not work with tracked changes enabled.


2023-01-21 14:18:33

Matt

The search pattern should be [0-9]@ rather than [0-9]*. Unlike in regular expressions, asterisk is not related to previous character or range.


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.