Smart Tip on Using Wildcards In MS Word

Filip Mitrovic
Analytics Vidhya
Published in
3 min readJun 28, 2021

--

Sometimes editing a MS Word document would require adding parenthesis around a number in a table. At least it did in my case.

While working on several hundred paged Word documents, with numerous tables in them, one of the tasks I was kindly charged with, was to add parenthesis around certain cells of the tables. Putting parenthesis was based on values from a different set of tables and couldn’t be linked automatically with ease.

After going from a one table cell to another and putting parenthesis around values manually, becomes frustrating and tedious. Almost seems like a torture technique. I felt that there is a better way to go about this task and waste less time.

Photo by Klim Musalimov on Unsplash

So, I experimented with wildcards. Now wildcards in MS Word allow for a lot of options in text editing. Before making my own wildcard rule, I went through some of the articles online on how issue I had could be resolved with use of wildcards. For some reason, explanation given in the article here from Cybertext blog, did not help in solving my issue.

In the case of documents I was editing, cells in the tables were populated with real numbers not integers, with one or two decimal places.

I will illustrate use of wildcards with following four pics.

In Picture 1, is an example of a run of the mill table in my documents. Tables had integer values as well, but I mostly had to put numbers with decimal points in parenthesis.

Example of a Word table with real numbers to be put in parenthesis.

Before using wildcards it was especially important to be able to put certain cells from the table in parenthesis and not the others. So in my case, I would highlight rows or columns that had to be transformed first and then put them through ‘Find and Replace’ Word function. To illustrate that in Picture 2, just a random section of the table was highlighted.

Example of highlighting a targeted section of the table to be put in parenthesis.

After selecting the section of the table with cells to be transformed to the parenthesis format, I would go through these steps:

  1. Call ‘Find and Replace’ dialog (keyboard shortcut is Ctrl+H). To enable wildcard option click on the ‘More’ tab on the left bottom corner and select ‘Use wildcards’ check box.

2. In ‘Find What’, I typed in: (<)(<*.*>)(>)

Represents any entry separated by a full stop. (<) and (>) are placeholders for start and end of the sequence that need to be replaced by a parenthesis

3. And in ‘Replace With’ typed in: \1(\2)\3

Adds parenthesis around the middle part of the sequence — any value separated with a full stop.

4. Then would select option ‘Replace All’

Following Picture 3 is how these action would look in Word itself.

Using defined wildcards in Word Menu

After the used function, table would look as in Picture 4.

Now this process has to be repeated for every highlighted section, but it beats going though each single cell and adding parenthesis by a longshot!

Now this combination can be simpler for the integer values.

Hope you will find this wildcard combination useful.

--

--

Filip Mitrovic
Analytics Vidhya

Believer in the whole "Better data, better lives" thing. Wish I had a dog.