Data validation: specifying a text format

  • Thread starter Thread starter Hall
  • Start date Start date
H

Hall

I want to limit a cell's input to a set format 9999-999, where a 9 is a
digit. Is this possible?
 
Hi!

If I understand what you want, try this:

Select the cell(s) you want to validate
Goto Data>Validation
Allow: Custom
Formula:

=AND(ISNUMBER(SUBSTITUTE(A1,"-","")+0),A1=TEXT(A1,"0000-000"))

Biff
 
Ooops!

Caught a bug.
=AND(ISNUMBER(SUBSTITUTE(A1,"-","")+0),A1=TEXT(A1,"0000-000"))

Change to:

=AND(ISNUMBER(SUBSTITUTE(A1,"-","")+0),A1=TEXT(A1,"0000-000"),LEN(A1)=8)

Biff
 

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

Back
Top