Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
kenelder
 
Posts: n/a
Default 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

  #2   Report Post  
Dave O
 
Posts: n/a
Default

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")

  #3   Report Post  
BobT
 
Posts: n/a
Default


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")

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date issue between Windows and Macintosh version dlg1967 Excel Discussion (Misc queries) 4 January 19th 05 03:51 PM
How do I add a date field in a spreadsheet? Minimidge Excel Worksheet Functions 2 January 6th 05 04:57 PM
Print Footer with Last Print Date field name Ted Excel Discussion (Misc queries) 1 December 23rd 04 02:46 PM
How can I format a cell so date field only displays the Month? tk_2u Excel Discussion (Misc queries) 3 December 4th 04 12:54 AM
Using formulas to determine date in one cell based on date in anot Gary Excel Worksheet Functions 2 November 22nd 04 08:11 AM


All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"