Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Conditional Formatting for Errant Phone Numbers.
Written by Allen Wyatt (last updated September 2, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003
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 | 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 Conditional Formatting dialog box.
=LEFT(A3,3)<>"240"
Figure 2. The Format Cells dialog box.
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. These steps will work:
Figure 3. The Conditional Formatting 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 (2978) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Conditional Formatting for Errant Phone Numbers.
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!
Conditional formatting is a great feature in Excel. Unfortunately, you can't sort or filter by the results of that ...
Discover MoreConditional formatting can be a great way to highlight specific information in your worksheets. This tip explains the ...
Discover MoreConditional formatting is a great feature for making the data in your worksheets more understandable and usable. What if ...
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 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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments