Finding Text at the End of a Table Cell

Written by Allen Wyatt (last updated September 5, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021


2

When Peter wants to find a word at the end of a paragraph, he searches for XXX^p and replaces it with YYY^p. This doesn't, however, find words at the very end of table cells. He wonders how he can search and replace the words at the end of table cells and if there is a special code similar to ^p.

There is no special code similar to ^p (end of paragraph) to indicate the end of a cell. There is a trick you can try, however, that works well for many people.

First, create a unique paragraph style that you will use only for the contents of the cells in your table. Make sure you apply this style to all of the cells within the table. Next, use Find and Replace to search for the style. In the Replace With box, enter the code ^& followed by what you want to add to the end of the cell. Then, step through all occurrences and do your replacements, as desired. The ^& code specifies that you want to replace what you found (the text in the cells formatted with the unique style) with what you actually found.

If you want to replace a specific word in the table cells (XXX) with something new (YYY), you can follow the same steps as above, simply search for any occurrences of XXX using the unique table-cell style and replace it with YYY. You'll still want to step through the matches and determine if the replacement should be made on a case-by-case basis, but you will be able to make the changes in your table much quicker.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13571) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 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

Saving Your Web Page

Want to save your document as a Web page? It's easy to do in Word; almost as easy as saving your document normally.

Discover More

Reading a PDF Newsletter on a Cell Phone

Sometimes creating a Word document is just the first step. Often you'll want to then convert it to a PDF file that can be ...

Discover More

Allowing for Words that Contain Numbers

When Excel does a spell-check of the information in a worksheet, you may want it to ignore words that contain numbers. ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Resizing Your Table

Need to make your table a different size? It's easy to do, using the same general technique you use when resizing a ...

Discover More

Setting a Default Table Border Width

When you insert a table into your document, it uses a standard-weight line around each cell in the table. If you want to ...

Discover More

Table Numbers are Skipped

What do you do if you add numbered captions to an element of your document (such as tables) and Word skips a number? ...

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 more than 5?

2022-03-14 10:35:17

Andrew

Krasimir,

Just a thought: Sometimes in situations such as this it may be easier to blow out (delete) all of the problematical characters (in your case the "г") and then reinsert them where necessary using find and replace or a macro.

Another trick is to use a sequence of find and replace operations starting with, for example, replacing all "г " with "г^pX#$%" - i.e., the "г" followed by "semaphore" text beginning with the ^p followed by some other text will not appear anywhere else in the document. Then run your macro knowing that all occurrence of "г" will have a paragraph marker after it. Finally, delete the semaphore text "^pX#$%" you previously added with a find and replace operation.

Andy.


2022-03-12 16:47:09

Krasimir Paskulov

Hello,
Thank you very much for this useful idea.
I've been trying to solve a similar problem for quite a while now, and I still haven't manage to find a solution.
It think it goes the opposite way, but I'm not the wise one here, so I'm asking you if this trick could be used to solve my problem.
Here's my case:
I'm from Bulgaria, and for some strange reason, there's a habit of putting г. (abbreviation for year) at the end of dates. I'm a translator and it hampers my work immensely. So I scratched my head for a solution to this nasty г. and here's what I fixed up:
First remove all useless multiple spaces (^w -> one space), and replace all г. ^p with г.^p
Then turn on Use wildcards and go through 3 steps, to remove all variants of г. in all possible positions.
Step 1:
([0-9])г. ([!А-Я])
([0-9]) г. ([!А-Я])
([0-9]) г.([!А-Я ^13])
\1 \2

Step 2:
([0-9])г. ([А-Я])
([0-9]) г. ([А-Я])
([0-9]) г.([А-Я])
\1. \2

([0-9])г.(^13)
([0-9]) г.(^13)
\1.\2

And I thought I'd made it, only I found out г. remained intact at the end of lines in table cells.

So do you think there's a way for me to use the style application trick AFTER I have performed those 3 steps?
Or should I rather first select all tables, use this special style all through the table content, then look for all cases of г. in this style only, remove them, then restore the tables' normal style?

Thank you very much.

Best regards,
Krasimir Paskulov


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.