+ Reply to Thread
Results 1 to 3 of 3

Multiple date formats need to be converted

  1. #1
    Registered User
    Join Date
    01-17-2005
    Posts
    37

    Multiple date formats need to be converted

    I have daily report files from 4 different locations. While I have been successful in getting the locations to use the same standard form, they each have developed their own practice for naming the files with the date. It would be very ideal to have the computer pull the date from the file name rather than having to manually enter it each time. Unfortunately, the only place the date is stored in the file is in the name. An example is below with the plant initials and the format in which they enter the date in the filename.

    FUR 07.01.2011
    DAY 07.01.11
    FAY 07-01-11
    SEA 7.1.11

    The entire filename is similar to "SEA SUPPLIER DOT 7.1.11.xls"

    While it would be easiest to get them to change to a standard formatting from this point forward, I still have years worth of data in the above format that I need to work with.

    The one that gives me the biggest headache is SEA. I am not sure how to attack this one as I am unable to do a =MID(...) formula because the location of the month and date will change depending on if it is one or two digits to make the month and date.

    Thanks for any help you can offer.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Multiple date formats need to be converted

    This might work:

    =DATEVALUE(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(A1,".xls","")," ",REPT(" ",50)),50)),".","-"))

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    01-17-2005
    Posts
    37

    Re: Multiple date formats need to be converted

    holy wow Dom, that works like a champ!! Thanks a bunch.

+ 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