+ Reply to Thread
Results 1 to 5 of 5

Problems recognizing dates from CSV import

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2013
    Posts
    3

    Problems recognizing dates from CSV import

    I need to import a lot of information from a large CSV file.

    Among others, it contains a timestamp that my Excel cannot recognize.
    It looks like this: 6/19/2017 10:27:30 AM

    (NB I'm using 24 and not 12 hours)

    I need the field to be recognized as a date and time, as I need to use it grouped in a Pivot table

    Can anybody help?
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Problems recognizing dates from CSV import

    You have an American Style date in string format, but are probably using a European regional setting. So you will need a helper column to convert it:
    =DATE(RIGHT(LEFT(C2,FIND(" ",C2)-1),4),I2,MID(LEFT(C2,FIND(" ",C2)-1),FIND("/",LEFT(C2,FIND(" ",C2)-1))+1,FIND("/",LEFT(C2,FIND(" ",C2)-1),FIND("/",LEFT(C2,FIND(" ",C2)-1))+1)-FIND("/",LEFT(C2,E2-1))-1))+TIMEVALUE(RIGHT(C2,LEN(C2)-FIND(" ",C2)))

    The derivation of this formula is shown in the attached spreadsheet in columns E:M. Row 3 has the individual pieces and Cell M3 is the formula with all the intermediate helper cells. Cell M2 is the same formula except that I kept replacing the intermediate helper formulas until the formula was expressed only in terms of column C.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Problems recognizing dates from CSV import

    The result will be the correct date / time, but you may have to reformat the cells - I don't know if the format I selected will "translate" into your regional settings.

    On the other hand, if you are using an American date style, the formula becomes a lot simpler: =DATEVALUE(C2)+TIMEVALUE(C2)

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Problems recognizing dates from CSV import

    You could use Data>Text to columns... with space as a delimiter to get the date and time in separate columns, then you could simply add the 2 columns to get the date/time value in one column.
    If posting code please use code tags, see here.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Problems recognizing dates from CSV import

    If you have access to Power Query you could easily convert the date column.

    1 Put the cursor in the table.

    2 Goto the Data tab and select From Table/Range to load the data into Power Query.

    3 Right click the Date column, select Change Type>Using locale...

    4 Select Date/Time from the Data Type dropdown and English (United States) from the Locale dropdown.

    5 Click OK.

    6 Click Close and Load.

+ 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] Not recognizing dates in column using Countifs
    By biznez in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-13-2016, 02:51 PM
  2. Need to import table from website. Excel is not recognizing the table
    By elitelimfish in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-17-2013, 04:02 AM
  3. Excel not recognizing dates in correct order.
    By totlkaos in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2012, 02:13 AM
  4. Not recognizing dates in drop down menu
    By SheilaV in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2010, 01:27 PM
  5. Recognizing European Dates as Dates in Excel 2007
    By sdekker22 in forum Excel General
    Replies: 1
    Last Post: 10-25-2009, 05:07 PM
  6. recognizing dates past End of Month
    By sk81222 in forum Excel General
    Replies: 6
    Last Post: 06-14-2006, 10:43 AM
  7. Excel not recognizing Dates properly.
    By Dan in forum Excel General
    Replies: 1
    Last Post: 03-23-2005, 04:06 PM

Tags for this Thread

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