Highlighting Cells with Text Over a Certain Length

Written by Allen Wyatt (last updated February 21, 2026)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


Bonnie has a worksheet that contains a large number of text values. She wonders if it is possible to use a conditional format to highlight cells that contain text that is longer than 25 characters. Due to restrictions at her company, she needs to do this without using a macro.

This is quite easy to do without a macro, but you do need to set up a conditional formatting rule that relies on a formula. Follow these steps:

  1. Select the cells that contain the text values.
  2. Display the Home tab of the ribbon.
  3. Click on the Conditional Formatting tool. Excel displays a group of options.
  4. Choose the New Rule option. Excel displays the New Formatting Rule dialog box.
  5. In the Select a Rule Type area at the top of the dialog box, choose Use a Formula to Determine Which Cells to Format. Excel changes the appearance of the New Formatting Rule dialog box. (See Figure 1.)
  6. Figure 1. The New Formatting Rule dialog box.

  7. In the formula space, enter the following formula: =LEN(A1)>25
  8. Click on Format and use the formatting controls to indicate how you want cells formatted.
  9. Click on OK. Excel saves and immediately applies the conditional formatting rule.

The formula you use in step 6 should reference the active cell in the range you selected in step 1. In this example, it assumes that the active cell is A1, but you should replace it with the cell that is appropriate for the cells you selected. In addition, you can modify the number of characters from 25 to whatever fits your needs.

If it is possible that some of the cells in the range could contain numeric values, then you may want the change the step 6 formula slightly:

=AND(ISTEXT(A1),LEN(A1)>25)

The formula checks that the cell contains text and its length. In this case, there are two references to cell A1 that should be modified to reflect the active cell in the cell range you selected.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13460) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel 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

Testing for an Empty Worksheet

If you are using a macro to process a number of worksheets, you may have a need to know if the worksheet is empty or not. ...

Discover More

Hiding Outline Symbols

Outline symbols are automatically displayed by Excel when you add subtotals or organize your data using an outline. If ...

Discover More

Displaying a Result as Minutes and Seconds

When you use a formula to come up with a result that you want displayed as a time, it can be tricky figuring out how to ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Conditionally Making a Sound

Need to have a sound played if a certain condition is met? It is rather easy to do if you use a user-defined function to ...

Discover More

Conditional Format that Checks for Data Type

Conditional formatting can be used to highlight cells that contain the improper type of data for your needs. This tip ...

Discover More

Automatic Lines for Dividing Lists

When preparing a report for others to use, it is not unusual to add a horizontal line between major sections of the ...

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 two minus 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 ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.