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 Word in Microsoft 365


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 Word in Microsoft 365.

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

Automatically Protecting After Input

Do you want user-entered data to be immediately protected so that it cannot be changed? This can be done relatively ...

Discover More

Printing Reports

The Report Manager allows you to create specialized reports that can be easily printed from your worksheet data. This tip ...

Discover More

The EDATE Function

Want to figure a date a certain number of months in the future or past? The EDATE function may be just what you need for ...

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)

Turning Off Automatic Resizing of Tables by Default

You can format your tables to either keep cell sizes static or to automatically resize based on cell contents. By ...

Discover More

Keeping Table Rows Together

When you create a table that extends beyond a single page, you may want to make sure that the information in a table row ...

Discover More

Formatting an ASCII Table with Tabs

If you get a document from a coworker that has tabs used to line up tabular information, you might want to change 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?

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.