Data Validation

CHuguley

New Member
Joined
Feb 17, 2002
Messages
45
I need to have a cell entry entered as: 400-xxx-xxx. I've entered all the necessary data (input message and error message). The problem appears to be in the settings. I custom formatted the cell but when I enter it correctly or incorrectly, I get the error message. Any help would be appreciated.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How did you customize the cell? What settings did you use in your validation? Is it text length? If so, change it to 12 not 10 to accomodate for the dashes that your user enters.
 
Upvote 0
Hi there

I'm assuming that the xxx implies a three digit number?

If not let me know and we will change the following

For data validation in cell A1, use the following

Choose Custom Data Validation
in the formula box put:

=IF(AND(LEN(A1)=11,VALUE(MID(A1,1,3))=400,ISNUMBER(VALUE(MID(A1,5,3))),ISNUMBER(VALUE(MID(A1,9,3))),MID(A1,4,1)="-",MID(A1,8,1)="-"),TRUE,FALSE)


This will ensure that you get the format 400-xxx-xxx
Anything else will be rejected.

Hope this helps

Richard
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,739
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top