+ Reply to Thread
Results 1 to 5 of 5

Text File to Excel - Won't Format as Date

  1. #1
    Forum Contributor
    Join Date
    05-13-2010
    Location
    Dallas, TX
    MS-Off Ver
    2019
    Posts
    129

    Text File to Excel - Won't Format as Date

    I have a text file that's opened with excel. Column A has dates, but Excel formats it as General. The date in A1 is 6242021, representing today. But if I try to convert that to a date format Excel shows all ######. I realize that Excel doesn't think that number is a date, but what's the best way to convert it to a date?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Text File to Excel - Won't Format as Date

    I would use text manipulation functions to parse out the month day year values, then use the date function.
    =DATE(RIGHT(text,4),LEFT(text,1),MID(text,2,2)) or similar.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    05-13-2010
    Location
    Dallas, TX
    MS-Off Ver
    2019
    Posts
    129

    Re: Text File to Excel - Won't Format as Date

    Interesting. Thanks. I was headed that way and thought there’s likely something easier I might be missing, but that’s totally doable.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Text File to Excel - Won't Format as Date

    If you have any control or influence over the text file, if you can ask/insist/demand that dates in your text file be sent as mm/dd/yyyy (or whatever matches your OS's system settings), then Excel can automatically recognize the date when it opens/imports the text file. But I cannot know if it is easier for you to request/demand a change in the text file or use a DATE() function in what you are given.

  5. #5
    Forum Contributor
    Join Date
    05-13-2010
    Location
    Dallas, TX
    MS-Off Ver
    2019
    Posts
    129

    Re: Text File to Excel - Won't Format as Date

    Actually the raw data text file has that field in mmddyyyy format. But if you just right click point to the text file and say open with Excel, the default import format is apparently General for all fields. This is something a clerk with be doing often, and I don't want her having to go to Excel, Open, point to the location, then go through the import wizard 3 times and finally say import as Text, not General. I doubt there's any way to specify that a default "Open with Excel" of a text file should use Text vs. General. But maybe there is. But since I'm doing an edit macro it's easy enough to format that as a date.

+ 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. i have to convert the csv file date format to excel date format
    By arindamsenaxa in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-17-2015, 03:37 AM
  2. Replies: 1
    Last Post: 12-09-2014, 07:17 AM
  3. Date Format Of User PC Changes Display format date of Excel File after update
    By waihar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2014, 03:09 AM
  4. Date format changes when creating text file from CSV
    By Kerno in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-13-2009, 01:54 AM
  5. [SOLVED] Text File creates incorrect Date format
    By Rob in forum Excel General
    Replies: 2
    Last Post: 06-23-2006, 02:55 AM
  6. [SOLVED] Date format not correct when you convert a CSV text file in Excel
    By Scarab in forum Excel General
    Replies: 2
    Last Post: 11-16-2005, 08:25 AM
  7. Excel Addin altering date format on text file import
    By RJ Lohan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2005, 12:06 AM

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