by Allen Wyatt
(last updated October 30, 2020)
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:
In other countries, however, the number would be shown in this manner:
Notice that the purpose of the commas and periods are exactly opposite in these two instances. In one case commands 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:
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:
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, and 2016.
Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!
When using Find and Replace, how Word handles the case of letters in replacements can be confusing. It needn't be, if you ...Discover More
Word allows you to search for specific ASCII codes in a document. If you use codes to search for alphabetic characters, ...Discover More
Find and Replace is a great tool, but what are you to do if your find or replace doesn't work as you expect? This tip ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.