Maintaining Text Formatting in a Lookup

Written by Allen Wyatt (last updated July 16, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


When you enter text into a worksheet, you can format that text in either of two ways: You can format all the text in the cell, or you can format just some of the text in the cell. Formatting all the text should be familiar to all readers, as it is quite common to make the contents of a cell bold or change its font.

Formatting some of the text within a cell may not be done as often, but it is just as easy to do as formatting the entire cell. All you need to do is, while editing the cell contents, select the text you want to format and then apply the desired formatting properties. For instance, you could make some portion of the text bold or some of it underlined. You can also change the font used by certain characters in a cell, which is often done to insert symbols in a cell or to use foreign-language characters within your regular text.

While formatting can make your information more understandable, and may in fact be required for your particular worksheet, there are some drawbacks. One of the biggest drawbacks is when you use formulaic references to the formatted text. Excel will only copy the bare contents of the referenced cell, not the formatting applied to text within that cell.

As an example, suppose you have a cell that contains Greek letters interspersed within the text of a cell, and you reference that cell in a formula such as the following:

=HLOOKUP(B7,A16:A29,C3)

Excel dutifully copies the contents of the cell, returning as the results of the formula, but it does not copy the formatting of the cell being referenced. This behavior is not limited to lookup functions, either; Excel behaves this way even with simple formulas, such as =B7.

There is no way around this drawback, short of writing a rather complicated macro that copies formats as well as content. Macros that copy cell formatting have been covered in past issues of ExcelTips; macros that copy individual character formatting within a cell are complex enough that they are beyond the scope of ExcelTips itself.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2318) applies to Microsoft Excel 97, 2000, 2002, and 2003.

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

Returning a Worksheet Name

Need to know the name of the current worksheet? You can use the CELL function as the basis for finding this information ...

Discover More

Working with Lotus 1-2-3 Spreadsheets

If you've got some older data around your office that started in an old Lotus 1-2-3 system, you may want to open it in ...

Discover More

Finding the Nth Root of a Number

Finding a square root is easy because Excel provides a worksheet function for that purpose. Finding a different root may ...

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 ExcelTips (menu)

Activating the Formula Bar with the Keyboard

Hate to take your hands off the keyboard while working on a worksheet? Here's one way to activate the Formula Bar without ...

Discover More

Counting Unique Values

Need to know a count of unique values in a range of cells? There are a couple of ways you can tackle the problem.

Discover More

Using Named Formulas Across Workbooks

You can use the naming capabilities of Excel to name both ranges and formulas. Accessing that named information in a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, 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 6 + 5?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, 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.