View Single Post
  #20   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Validating Dates

Hi Randall,

Have I missed the point here; or do you really need to validate?
Why not just use "date()" command,


I assume you mean Excel's worksheet function Date().

If so, the required syntax for the function is: DATE(year,month,day).

Two points spring from this:

(1) The function cannot be used (directly) on dates in the format indicated
by the OP's opening line:

I'm trying to validate dates whuen I make an input ("dd/mm/yy").


This objection is, however, clearly superable


(2) You give the example:

Why not just use "date()" command, and it will adjust "31/6/05" to 1/7/05"


But what makes you think that "31/6/05" and "1/7/05" are necessarily
conterminous?

And *if* you believe that they are, do you also believe that the following
results, from the intermediate window, are what the OP might intuitively
expect as validated dates:

?format([date(2005,13.5,34)], "mmm/dd/yyyy")
Mar/06/2005

?format([date(2005,pi(),pi())], "mmm/dd/yyyy")
Mar/03/2005

?format([date(2005,11.5,77)], "mmm/dd/yyyy")
Jan/16/2006

---
Regards,
Norman


"randallc" wrote in message
...
Hi,
Have I missed the point here; or do you really need to validate?
Why not just use "date()" command, and it will adjust "31/6/05" to 1/7/05"
for you anyway?
Best, Randall