ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Validating a date field (https://www.excelbanter.com/excel-discussion-misc-queries/13497-validating-date-field.html)

kenelder

Validating a date field
 

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


--
kenelder
------------------------------------------------------------------------
kenelder's Profile: http://www.excelforum.com/member.php...o&userid=20020
View this thread: http://www.excelforum.com/showthread...hreadid=346034


Dave O

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)),ISNU MBER(YEAR(A2))),"OK","Invalid
date entered")


BobT


Doesn't the formula below work for any number 1 and
<2,958,465?
=If(and(A21,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.

-----Original Message-----
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)),ISN UMBER

(YEAR(A2))),"OK","Invalid
date entered")

.



All times are GMT +1. The time now is 02:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com