LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check if date is valid


I've got an Excel sheet for data-input. For dates it should be possible
to define either a year or a complete date (day-month-year). If one
defines a year it is being converted to 01-01-year. In latter case the
exact date is not known or doesn't matter.

Anyway, for this reason I cannot use the DateFormat for the cells of a
column ("E"), because it would turn 2005 into something like 12-03-1905
or something similar I can't use. I've formatted the cells as Text.

How to check if the entered full date is a valid date?

I can check with CInt(Mid(Cells(i, "E"), 4, 2)) 12 in a For-loop with
parameter 'i' per row and similar If-constructions if the individual day
and month field are not faulty, but 31 April or 29 February (when
there's only 28 days) shouldn't pass the check.

So I'm wondering how I can check the dates? IF it's possible.

Later on the Excel sheet's data will be imported by a PHP script where
all fields are checked again just to be on the safe side and properly
inserted into the database. Question "why bother with Excel-level
checking?". Answer: it's been requested by my employer. If isolated day
/ month checking is as far as I can go... okay, nothing to be done about
that, but IF there's a way to check if a complete date is valid....
please share your thoughts :)


--
Lava
------------------------------------------------------------------------
Lava's Profile: http://www.excelforum.com/member.php...o&userid=27793
View this thread: http://www.excelforum.com/showthread...hreadid=477441

 
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
How to check valid Date value? hstijnen Excel Worksheet Functions 1 August 14th 06 01:25 PM
To to check whether a string is a valid reference Nick Shinkins Excel Programming 3 December 17th 04 04:27 PM
Check for valid SQL server connection Robert W. King Excel Programming 1 September 8th 04 09:29 AM
How to check that a string is a valid formula ? Adrian[_7_] Excel Programming 5 July 30th 04 07:10 PM
check for valid file pabs[_21_] Excel Programming 2 January 15th 04 06:52 AM


All times are GMT +1. The time now is 03:32 PM.

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"