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

Number of Terms in a Formula

Formulas are made up of operands that separate a series of terms acted upon by the operands. You may want to know, for ...

Discover More

Embedding Your Phone Number in a Workbook

Want to provide a bit of contact information in a workbook? A great place to do it (out of sight, but not inaccessible) ...

Discover More

Contingent Validation Lists

Data validation can be used to create lists of choices for entry into a particular cell. Using the techniques in this tip ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Using Outline Numbering in a Table

Can you put a numbered outline in a table? Yes, you can. But Word is rather prickly when it comes to using the keyboard ...

Discover More

Changing Table Cell Text Direction

When creating a table, you can turn the orientation of the text, within a cell, by ninety degrees in either direction ...

Discover More

Summing a Table Column

Need to add a sum to a column of figures in a table? Word makes it relatively easy to provide the sum you need.

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?

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.