## Cleaning phone numbers in Excel or OO Spreadsheet

Personally I’ve been using Excel for storing phone numbers for almost twenty years now. Every now and then I don’t recognize the phone number so I need to search in my Excel sheet looking up who called me. After ten years and 500 phone numbers plus, the information stored in the Excel sheet is ‘poluted’ with hyphens and spaces. So in this article I’ll try to explain how to clean up messy telephone numbers by removing spaces and separators in Excel?

## How to split numbers and text from a string in Excel

I received an e-mail from Marc, in which he asked me whether it is possible to split numbers and text in Excel. The answer to the solution is based upon determining the first position of a number in a string, you can do that by using the following formula.

The next trick is to determine the text within a string:
A101 will become A when using the following formula

101A will become A when using the following formula

To determine the numbers within a string:
A101 will become 101 when using the following formula

101A will become 101 when using the following formula

You might want to convert the text string to numbers by using the following formula.

A101 will become numeric value 101 when using the following formula

101A will become numeric value 101 when using the following formula

As I’m currently working a lot with Excel, I get a lot of questions like “How do I do this?” or “How do I do that?”. Yesterday someone asked me how to convert a data string to a MAC address. The standard format for printing MAC addresses in human-friendly form is six groups of two hexadecimal digits, separated by hyphens (-) or colons (:), in transmission order, e.g. 01-23-45-67-89-ab, 01:23:45:67:89:ab. In this article, I’ll give you examples of how to add, remove, or change the separator for MAC addresses in MS Excel or OO Spreadsheet.

Adding a seperator (change 0123456789ab into 01-23-45-67-89-ab)

An alternate solution was send in by Franco Magliaro see below:

Removing a separator (change 01-23-45-67-89-ab into 0123456789ab)

or the easy way

Changing a separator (change 01-23-45-67-89-ab into 01:23:45:67:89:ab)

or the easy way ðŸ™‚

An alternate solution, to convert the Cisco 0123.4567.89ab MAC format to the F5 load balancer MAC format of 01:23:45:67:89:ab, was send in by Mike Wintrode. To add an extra twist, the F5 load balancer also removes the leading “0” in any pair, so for instance 00:14:0F:80:a3:01 would show as 0:14:f:80:a3:1.

So Mike created the following:

The basic premise utilizes an “IF” statement to check for a preceding “0” and if present to return the next character, and if not to return both characters.

Adam Heath was so kind as to send me an Exel template that uses most of the above formulas (thanks Adam!), which you can download here.