data validation question

P

Paul James

I would like to restrict data entry in a field that's used to collect Tax ID
or Employer ID numbers. The format for this field should be two numbers,
followed by a hyphen, followed by seven numbers. For example:

12-1234567

One problem we've been experiencing is that some people have been entering
their social security numbers by mistake, and I'd like to put a data
validation rule in the cell that would require the format for the Tax ID
number as shown above, which would only take the two digits, hyphen and
seven digits.

Can anyone tell me what the rule should be?

Thanks in advance,

Paul
 
K

keepITcool

assuming the "value" will be entered in a cell with TEXT ("@"")
numberformat and neither element can be 0, try like

=AND(MID(A1,3,1)="-",-LEFT(A1,2)<1,-RIGHT(A1,7)<1)

keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top