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

Removing Pictures from Multiple Files

Working with a single document is easy. Working with thousands of documents becomes much harder. If you need to get rid ...

Discover More

Dictionary Shortcut Key

Need a quick way to display the dictionary or other grammar tools? Use one of the handy built-in shortcuts provided by Word.

Discover More

Suppressing Headers or Footers

Don't want a header or footer to appear on just a portion of your document? It's easy to do when you understand that ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (menu)

Deriving a Secant and Cosecant

Two rather common trigonometric functions are secants and cosecants. Excel doesn't provide functions to calculate these, ...

Discover More

Totaling Across Worksheets

Want to sum the values in the same cell on a range of worksheets? It's not as easy as summing a range on the same ...

Discover More

Averaging Values for a Given Month and Year

Excel is often used to analyze data collected over time. In doing the analysis, you may want to only look at data ...

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 seven more than 1?

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.