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


2

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

Precisely Adjusting Table Column Widths

If you want to resize the width of your table columns, you can do it using a mouse, but you can get more precise widths ...

Discover More

Resetting Ribbons

Word allows you to customize the program's ribbon tabs so they more closely match the way you want to work. At some ...

Discover More

Using the System Configuration Utility

Want to change what happens when Windows is started? It's easy to make changes if you know how to use the System ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

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

Replacing the Space between the Last Two Words of Each Paragraph

Some replacement tasks can seem daunting, but Word provides some great tools for making just about any replacement you ...

Discover More

Changing the Position of the Dollar Sign

When you receive documents created by others, it is not unusual that you'll want to edit what they've written. For ...

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 four less than 7?

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.