+ Reply to Thread
Results 1 to 2 of 2

Enforce a datetime format and validate it

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Enforce a datetime format and validate it

    Hi..

    I'm trying to validate that a person has a datetime in the format CCYYMMDDHHMMSS and that it is a valid date and less than today. Been messing around with IF, MID, MEDIAN etc without much success. Can it be done? even for the first 6 characters as I know there is a formula size limit - been trying to avoid macros, but if thats my only option...

    I look forward to your expert opinion...

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Enforce a datetime format and validate it

    How about this:
    =IFERROR(IF(LEN(A1)<>14,NA(),IF((MID(A1,5,2)&"/"&MID(A1,7,2)&"/"&LEFT(A1,4)&" "&MID(A1,9,2)&":"&MID(A1,11,2)&":"&MID(A1,13,2))+0>=TODAY(),NA(),"Valid")),"Not Valid")
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1