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.

Conditional Formatting for Errant Phone Numbers

by Allen Wyatt
(last updated February 15, 2014)

1

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:

  1. Select the cells containing the phone numbers. (For the sake of this example, I assume that the first cell you select is A3.)
  2. Choose Conditional Formatting from the Format menu. Excel displays the Conditional Formatting dialog box.
  3. Use the Condition drop-down to choose Formula Is. (See Figure 1.)
  4. Figure 1. The Conditional Formatting dialog box.

  5. In the formula area, to the right of the drop-down list used in step 3, enter the following formula, replacing A3 with the address of the active cell selected in step 1:
  6.      =LEFT(A3,3)<>"240"
    
  7. Click Format to display the Format Cells dialog box. (See Figure 2.)
  8. Figure 2. The Format Cells dialog box.

  9. Set the formatting options to highlight the errant phone numbers, as desired.
  10. Click OK to dismiss the Format Cells dialog box. The formatting you specified in step 6 should now appear in the preview area for the condition.
  11. Click OK.

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:

  1. Select the cells containing the phone numbers. (For the sake of this example, I assume that the first cell you select is A3.)
  2. Choose Conditional Formatting from the Format menu. Excel displays the Conditional Formatting dialog box.
  3. Use the Condition drop-down to choose Cell Value Is.
  4. Use the next drop-down to choose Not Between.
  5. Set the lower and upper boundaries of the condition to 2400000 and 2409999, respectively. (You are specifying that the condition is met if the number is not between 2400000 and 2409999, which is the range of acceptable phone numbers.) (See Figure 3.)
  6. Figure 3. The Conditional Formatting dialog box.

  7. Click Format to display the Format Cells dialog box.
  8. Set the formatting options to highlight the errant phone numbers, as desired.
  9. 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 condition.
  10. Click OK.

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.

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

Changing Sort Order

When sorting information, Word follows some pretty strict rules. If you want to modify how those rules are applied, you may ...

Discover More

Protecting Many Worksheets

Need to protect a lot of worksheets? Rather than protect the sheets individually, you'll appreciate the macros discussed in ...

Discover More

Avoiding Rounding Errors in Formula Results

Some formulas just don't give the results you expect. Sometimes this is due to the way that Excel handles rounding. Here's ...

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

Understanding Conditional Formatting Conditions

Conditional formatting can be a great way to highlight specific information in your worksheets. This tip explains the ...

Discover More

Sorting or Filtering by Conditional Format Results

Conditional formatting is a great feature in Excel. Unfortunately, you can't sort or filter by the results of that ...

Discover More

Conditionally Formatting Non-Integers

The conditional formatting capabilities of Excel are very helpful when you want to call attention to different values ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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 five less than 5?

2015-02-22 22:43:25

Rick

A B c
3/16/2014 555-294-1030 --
3/17/2014 555-970-1190 --
3/17/2014 555-577-6569 --
3/17/2014 555-492-9553 --
3/17/2014 555-492-9553
--
3/17/2014 555-577-6569 --
3/17/2014 555-709-1379 --
This is a small example of my phone bill in excell, is it possible to use a formula to put the word work next to the phone numbers that would be used for work only? Thanks for you help.


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.