+ Reply to Thread
Results 1 to 2 of 2

Macro to identify 3-digit and 4-digit numbers as valid dates

  1. #1
    Registered User
    Join Date
    03-04-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    6

    Macro to identify 3-digit and 4-digit numbers as valid dates

    Hello friends,

    I want to convert 3-digit and 4-digit numbers as proper valid dates in the following format
    3 digits
    d-mmm-yyyy
    d-mmm
    dd-mmm

    4 digits
    d-mmm-yyyy
    dd-mmm-yyyy
    dd-mmm

    For example:
    * If Cell A1 has 111 -> corresponding cells should have 1-jan-1991, 1-jan-2001, 11-Jan, 1-Nov (that is d-mmm-yyyy, d-mmm-yyyy, d-mmm, dd-mmm)
    * If Cell A1 has 1111 -> corresponding cells should have 1-Nov-2001, 1-Nov-1901, 11-Jan-2001, 11-Jan-1901, 1-Jan-2011, 1-Jan-1911, 11-Nov (that is d-mmm-yyyy, d-mmm-yyyy, dd-mmm-yyyy, dd-mmm-yyyy, d-mmm-yyyy, d-mmm-yyyy, dd-mmm)
    * If cell A1 has 456 -> corresponding cells should have 4-May-1906, 4-May-2006 (that is d-mmm-yyyy, d-mmm-yyyy)
    * If Cell A1 has 3239 -> corresponding cells should have 3-Feb-1939, 3-Feb-2039 (that is d-mmm-yyyy, d-mmm-yyyy)

    If a particular 3-digit and 4-digit number does not convert into a proper valid date, the corresponding cell should remain blank. Year should be 20th and 21st centure (1900-1999 or 2000-2099)

    I am struggling since past couple of days and I tried splitting numbers, putting filters, concatenate formulas etc but I am not able to set all conditions. I thought macro based solution or a user defined function would be better but I am unable to write it and need help. Appreciate if I can get some start here...

    Thank you.

  2. #2
    Registered User
    Join Date
    03-04-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    6

    Re: Macro to identify 3-digit and 4-digit numbers as valid dates

    Please give me some idea/logic to achieve this. Thanks
    Crosspost here : http://www.mrexcel.com/forum/excel-q...ml#post4131622
    Last edited by gojakie; 04-16-2015 at 10:23 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] LOTTERY FILTER#4, Find if 1 Digit Sum of 2 Digit or 3 Digit, Single Cell w/ dash
    By david gonzalez in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2014, 12:57 AM
  2. Replace all one-digit number with two-digit numbers
    By sandykunaish in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-20-2013, 09:56 AM
  3. [SOLVED] macro to extract 9 digit numbers as well as alpha numberic 9 digit numbers from txt file
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2012, 10:15 AM
  4. To count numbers with 4 digit/5 digit with given Range.
    By ebin charles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2012, 08:49 AM
  5. [SOLVED] How do I identify the 7th digit in a 13 digit number, then establi
    By Catherine in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-04-2005, 02:06 PM

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