Written by Allen Wyatt (last updated May 26, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021
If you use Excel to store a list of phone numbers, you may want a way to determine if any of the phone numbers in your list are outside of a specific range. For instance, for your area, only phone numbers in the 240 exchange (those beginning with 240) may be local calls. You might want to highlight all the phone numbers in the list that do not begin with 240, and therefore would be long distance.
The way that you do this depends on whether your phone numbers are stored as text or as formatted numbers. If you enter a phone number with dashes, periods, parentheses, or other non-numeric characters, then the phone number is considered a text entry. If you format the cells as phone numbers (Format Cells dialog box | Number tab | Special | Phone Number), then the phone number is considered a number and formatted for display by Excel.
If your phone numbers are text entries, then use these steps to apply the desired conditional formatting:
Figure 1. The New Formatting Rule dialog box.
=LEFT(A3,3)<>"240"
These steps will even work if the phone numbers are numeric, but you may want to use a different approach if the phone numbers were entered as numbers. The following steps will work:
Figure 2. The New Formatting Rule dialog box.
If you want to convert your textual phone numbers to numeric phone numbers, so that you can use this last method of conditional formatting, you need to "clean up" your list of numbers. In other words, you need to remove all non-numeric characters from the phone numbers. You can do this using Find and Replace to repeatedly remove each non-numeric character, such as dashes, periods, parentheses, etc. Once the phone numbers are clean, you can format them as phone numbers (using the Format Cells sequence mentioned earlier in this tip) and use the conditional formatting just described.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6178) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021. You can find a version of this tip for the older menu interface of Excel here: Conditional Formatting for Errant Phone Numbers.
Program Successfully in Excel! This guide will provide you with all the information you need to automate any task in Excel and save time and effort. Learn how to extend Excel's functionality with VBA to create solutions not possible with the standard features. Includes latest information for Excel 2024 and Microsoft 365. Check out Mastering Excel VBA Programming today!
If you want to get rid of conditional formatting rules, but retain any formatting that was applied by those rules, then ...
Discover MoreIf you want to highlight cells that contain certain characters, you can use the conditional formatting features of Excel ...
Discover MoreConditional formatting does not allow you to change the typeface and font size used in a cell. You can write your own ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments