View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default if until requirement met

Assuming by six you mean "###/###":

'=AND(LEN(A1) = 7,
ISNUMBER(VALUE(LEFT(A1,3))),MID(A1,4,1)="/",ISNUMBER(VALUE(RIGHT(A1,3))))

Assuming by 16 you mean "########/########":

'=AND(LEN(A1) = 17,
ISNUMBER(VALUE(LEFT(A1,8))),MID(A1,9,1)="/",ISNUMBER(VALUE(RIGHT(A1,8))))

I advise that you copy the formulae and paste to, say, a code module (not a
worksheet), then correct for wordwrap. Copy again after correcting the
wordwrap and paste to the formula window using Ctrl_V as per Norman's advice.

Regards,
Greg


Hi Greg,
This is excellent! I love it.
You wouldnt happen to know a magic formula to require 6 or 16 characters
(numbers, but entered as text) for validation like this?
Thanks.
Stefan

Greg Wilson wrote:

=AND(LEN(A1) = 5,
ISNUMBER(VALUE(LEFT(A1,2))),MID(A1,3,1)="/",ISNUMBER(VALUE(RIGHT(A1,2))))



--
Message posted via http://www.officekb.com