Validating a date field

  • Thread starter Thread starter kenelder
  • Start date Start date
K

kenelder

I need Excel to validate that an entry in a date field is correct.
Specifically, if someone includes the day of the week in an entry
(e.g., Wed 02/16/05) I need Excel to display "You entered an incorrect
date format. Enter the date as mm/dd/yy and do not include the day of
the week."

Can anyone tell me how to do that?

Ken Elder
Oklahoma City
 
This formula checks the entry in cell A2 to verify that it contains a
month, day, and year:
=IF(AND(ISNUMBER(MONTH(A2)),ISNUMBER(DAY(A2)),ISNUMBER(YEAR(A2))),"OK","Invalid
date entered")
 
Doesn't the formula below work for any number >1 and
<2,958,465?
=If(and(A2>1,A2<2958,465),"OK","Invalid date entered")
should do the same thing

=If(and(A2>"b1",A2=<today(),"OK","Invalid date entered")
might suit better, with b1 refers to the earliest date you
allow and you can use =<today+90 for eaxample if you allow
entries 90 days in advance, etc.
 

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

Similar Threads


Back
Top