View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_16_] Rick Rothstein \(MVP - VB\)[_16_] is offline
external usenet poster
 
Posts: 1
Default validating telephone format

Are you sure? Try entering this... 1e3-4e6-7e90

Rick


"Theo" wrote in message
...
Worked like a charm!!!
Thanks!
T

"MrAcquire" wrote:

Assuming that your phone number is in cell A2, enter the following in B2:

=AND(LEN(A2)=12,ISNUMBER(VALUE(LEFT(A2,3))),ISNUMB ER(VALUE(MID(A2,5,3))),ISNUMBER(VALUE(RIGHT(A2,4)) ),MID(A2,4,1)="-",MID(A2,8,1)="-")

BTW, I don't think your formula will validate correctly if the dashes are
in
the wrong position.

"Theo" wrote:

I need to validate that telephone numbers are entered in this format:
###-###-####.

I found something that was close:
=AND(LEFT(A2,1)="C",LEN(A1)=16,ISNUMBER(SUBSTITUTE (RIGHT(A2,14),"-","")*1),LEN(SUBSTITUTE(RIGHT(A2,13),"-",""))=12)
(
it validates this format:
C-###-#####-####.
But I have not been able to successfully adapt the above to what I
need.
Any help would be appreciated.