Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default validating telephone format

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default validating telephone format

On Feb 11, 9:26 pm, 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.


Without thorough testing this formula appears to be working:
AND(ISNUMBER(LEFT(A1;3)*1);MID(A1;4;1)="-";ISNUMBER(MID(A1;4;3)*1);MID(A1;8;1)="-";ISNUMBER(RIGHT(A1;4)*1))

Per Erik
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 62
Default validating telephone format

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.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 66
Default validating telephone format

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.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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.




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default validating telephone format

I am pretty sure this formula is fool-proof...

=AND(LEN(A2)=12,SUMPRODUCT(--ISNUMBER(--MID(A2,ROW($1:$12),1)))=10,MID(A2,4,1)="-",MID(A2,8,1)="-")

Rick


"Theo" wrote in message
...
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.


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default validating telephone format

Or variations on this... -23--12--123

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom telephone number format [email protected] Excel Discussion (Misc queries) 2 July 11th 07 09:34 PM
Can I format telephone numbers? SouthAfricanStan Excel Worksheet Functions 3 August 24th 06 08:14 PM
Format Telephone Cell Range Victor Costello Excel Worksheet Functions 2 October 2nd 05 07:42 PM
how do i format telephone numbers Vin Excel Discussion (Misc queries) 1 May 30th 05 02:46 AM
Telephone number format MarkT Excel Discussion (Misc queries) 6 January 18th 05 10:39 PM


All times are GMT +1. The time now is 08:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"