ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   get actual date from variable text string (https://www.excelbanter.com/excel-programming/379756-re-get-actual-date-variable-text-string.html)

NickHK

get actual date from variable text string
 
Richard,
Excel will generally accept date in many formats, with a suitable separator.
As Jon pointed out, 113006 would be a problem as it appears to be just a
number (or text).
However, you will have trouble with dates where the day is not unambiguous
e.g. <13.

For this, you will have to process it yourself (Left,Mid,Right) and
DateSerial.
If you cannot tell if say 12/10/2007 falls in December or October, Jon's
Option 2 is the solution.

If possible, provide the user with a UI (possibly with a calendar control)
to ensure consistent date/data entry and avoid this mess.

NickHK

"Richard" wrote in message
...
I'm importing dates that are from a text field filled in by numerous

people,
so it could be in a host of formats.
e.g. 30-Nov-06 or 113006 or 11/30/2006 or November 30th, 2006.

How can I convert to true Excel Date format?

(I realize there may be no macro that gets it right all the time.)
--
Richard





All times are GMT +1. The time now is 02:01 PM.

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