Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Conditional Format that Checks for Data Type.

Conditional Format that Checks for Data Type

Written by Allen Wyatt (last updated May 27, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


Joshua is trying to establish a conditional format that will alert a user that text data has been entered into a cell intended for numerical data or when numerical data has been input into a cell intended for text data.

A conditional format can be used to draw attention to when an improper value (text or numeric) has been entered in a cell, but a more robust approach might be to prohibit the improper value from being entered in the first place. This can be done with the data validation capabilities of Excel. These capabilities have been discussed, in detail, in other ExcelTips; more information can be found here:

http://excelribbon.tips.net/C0786_Data_Validation.html

Using data validation you can specify the type and range of data permitted in a cell, along with how stringently you want that specification followed. If you prefer to not use data validation for some reason, you can set up a conditional format that will verify if the information placed in a cell is of the data type you want. Follow these steps:

  1. Select the cells that you want conditionally formatted.
  2. With the Home tab of the ribbon displayed, click the Conditional Formatting option in the Styles group. Excel displays a palette of options related to conditional formatting.
  3. Choose Highlight Cells Rules and then choose More Rules from the resulting submenu. Excel displays the New Formatting Rule dialog box. (See Figure 1.)
  4. Figure 1. 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.
  6. In the Format Values Where This Formula Is True box, enter one of the following formulas. (The first is if you want to highlight the cell if it contains text; the second if it contains a number. Make sure you replace A1 with the cell address of the cell in the upper-left corner of the range selected in step 1.)
  7.      =ISTEXT(A1)
         =ISNUMBER(A1)
    
  8. Click Format to display the Format Cells dialog box.
  9. Using the controls in the dialog box, specify a format that you want used for those cells selected in step 1. For instance, you may want bold text in a red typeface.
  10. Click OK to dismiss the Format Cells dialog box. The formatting you specified in step 7 should now appear in the preview area for the rule.
  11. Click OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7073) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Conditional Format that Checks for Data Type.

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

Font Changes when Pasting to Another Document

When you copy information from one document and paste it into another, you may not always get what you expect. If the ...

Discover More

Use Filenames that Sort Properly

When storing your Excel workbook, you need to specify a file name to be used for the workbook. Take a moment to consider ...

Discover More

Entering a Page Break from the Keyboard

Need to force Word to move text to the top of the next page? It's easy when you use the keyboard shortcut for a page break.

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 (ribbon)

Shading Based on Odds and Evens

You can use conditional formatting to add shading to various cells in your worksheet. This tip shows how you can shade ...

Discover More

Controlling Data Entry in a Cell

Sometimes you want whatever is displayed in one cell to control what is displayed in a different cell. This tip looks at ...

Discover More

Conditional Page Breaks

Need to have your worksheet printout start on a new page every time a value in a column changes? There are a couple of ...

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 - 0?

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.