+ Reply to Thread
Results 1 to 3 of 3

Sorting out dates

Hybrid View

  1. #1
    Registered User
    Join Date
    01-07-2016
    Location
    The Netherlands
    MS-Off Ver
    2010
    Posts
    1

    Sorting out dates

    Hi guys,

    I need to load an excel file into SPSS but am running into some issues with the data format. I've attached the date samples in a separate file, I copied it down from a online survey database which got samples ranging from September 30th, 2015 to November 13th, 2015. However in the file, dates like (B1) 01/10/2015 are displayed correct in the cell but when I try to set the format to date it will turn into MM/DD/YYYY while I need DD/MM/YYYY. These specific cells, in which the days and months which can be correctly used interchangeably between the metric and imperial system, will unfortunately not load properly into SPSS as a result. Any date of the 13th or higher, such as 30/09/2015, works fine.

    Any idea on how I can solve this without having to type out manually? Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,079

    Re: Sorting out dates

    Excel's date format gets it from Windows Locale, ie if your region is set to Europe it will be dd/mm/yyyy if it's set to USA then it will be mm/dd/yyyy.
    Which suggests that you can't have a spreadsheet consisting of dd/mm/yyyy AND mm/dd/yyyy dates at the same time.

    Use LEFT MID RIGHT forumlas to manipulate the parts of each date into the correct order.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Sorting out dates

    Welcome to the forum.

    Looking at your file, the cells with the dates are formatted with three different formats:
    - 'General' (which will display the date based on your regional settings)
    - 'Date' (which will also display the date based on your regional settings)
    - 'Custom' (which is set to mm dd yyyy, so will always display in this American format)

    If you select all the data and format the cells as 'Date', you'll get all the dates in the date format specified in your regional settings, as Special-K as said. Excel is clever enough to realise that 10th day of 14th month cannot be correct, so a date of 14 10 2015 will always be understood as 14th October.
    Where you run into problems is the ambiguous dates such as 04 05 2015. If you format this as a date and it comes out as 5th April when you know it should be 4th May, then you can use DATE to switch the day and month. The DATE function syntax is Date (Year, Month, Day) so if you give it the day from an incorrect date as the month, and the month as the day, that will swap the day and month around - for example, if the incorrect date is in B1, use this:
    Formula: copy to clipboard
    =DATE(YEAR(B1),DAY(B1),MONTH(B1))


    Hope that helps.
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

+ 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. Sorting dates as I know them.
    By BrianBricky in forum Excel General
    Replies: 6
    Last Post: 01-07-2014, 05:27 AM
  2. [SOLVED] Sorting Dates
    By alf40 in forum Excel General
    Replies: 10
    Last Post: 05-02-2013, 12:09 AM
  3. Sorting with Dates!
    By aidan80 in forum Excel General
    Replies: 8
    Last Post: 03-25-2009, 11:51 AM
  4. Sorting with Dates?
    By aidan80 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-24-2009, 10:11 AM
  5. Sorting dates
    By Heather in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  6. Replies: 1
    Last Post: 06-22-2005, 10:05 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