Try setting your Validation to "Custom", not Whole Number, for you data
range... use your same formula though.
Rick
Thanks everyone for your suggestions. It would appear that I need to
be a bit more specific.
The current format for these cells is [>99999]00000-0000;00000 so that
the users don't have to worry about the dash
I'm not worried about leading 0's as all my users are in NY State in
locations where the zip code should start with a 1.
And, I had an error in my original formula. The correct formula I was
trying to use was:
=OR(LEN(B4)=5,LEN(B4)=9)
With the Validations set to Allow Whole Number
The problem I am having is that regardless of the number of digits
involved, I receive the error alert.
If I am missing anything, please let me know.
On Oct 30, 8:43 pm, "Rick Rothstein \(MVP - VB\)"
I ruled out that we were talking about Custom/Special/ZipCode+4
format
because the OP asked about checking the length equal 4... a 5-digit
entry
would appear with 4 leading zeroes and that seemed like an unlikely
default
for a 5-digit zip code. I sort of ruled out that we were talking
about
Custom/Special/ZipCode formatting because 12345 would enter as a
number
(right justified) whereas 12345-6789 would enter as text (left
justified).
Remember, I started my response by asking if a dash could be present
and
then predicated my answer on it being allowed. Anyway, with those
conditions
ruled out, I figured that to have a consistent display (all justified
the
same way), the OP almost had to be formatting his column as Text. Of
course
I could be wrong, but that was my thinking at the time.
Rick
This all depends on how the zip codes are entered.
Are they formatted as TEXT to allow for leading 0s? Are they
formatted
using one of the existing zip code formats? Are they formatted
using a
custom number format?
If they're formatted as zip code or a custom number then your
formula
fails when having to deal with leading 0s.
--
Biff
Microsoft Excel MVP
"Rick Rothstein (MVP - VB)" <
[email protected]>
wrote in
messageI am setting up a sheet to that will include zip codes. How do I
set
the validation to only allow a 5 digit or 9 digit value?
I've tried a Whole number with:
=OR(LEN(B3)=5,LEN(B4)=9)
but this doesn't allow anything to be entered. I've been
searching
thru the group for 2 days, and can't find what I need.