Phone numbers and Parentheses


Posted by Ken on June 20, 2001 11:05 AM

I have made a table of phone numbers in Excel. The only problem is that they are all in the wrong format. This is an example of what they are now:
293 210 2345 or 1 213 348 8390

What I would like to do is set up some sort of code or macro that would allow me to place parentheses around the area codes or, for the first set, place a parentheses around the first three numbers; and on the second set, bypass all the ones and place parenthese around the next 3 sets of numbers. If anyone knows the solution to this, please email me with the answer with all haste. Thank you

Ken

Posted by mseyf on June 20, 2001 11:31 AM

Assuming the number is in A1:

=IF(LEFT(TRIM(A1),2)="1 ",TEXT(VALUE(SUBSTITUTE(A1," ","")),"0 (000) 000 0000"),TEXT(VALUE(SUBSTITUTE(A1," ","")),"(000) 000 0000"))

HTH

Mark




Posted by Ken on June 20, 2001 12:36 PM

First off, I have no idea where to put the formula or how it is going to work. Secondly, i made a mistake when i gave examples of the numbers. There are actually three types

1928 982 823 (i need parentheses around the first three numbers after the 1, not including it)

987 938 3488 (parenthese around the first 3)

0101 283 383 2938 (parentheses around the first set of 3, not the first four numbers because that is the international dialing)