+ Reply to Thread
Results 1 to 6 of 6

Sorting inconsistent dates

  1. #1
    Registered User
    Join Date
    10-14-2010
    Location
    BC Canada
    MS-Off Ver
    Excel 365
    Posts
    77

    Thumbs up Sorting inconsistent dates

    I'm trying to write a macro that sort how much time someone works on a date.
    I get sheets that show a date, a job and then how many hours worked

    Problem is that everything is formatted as "General" as well I get different formats,

    For example Friday November 30th 2018 could come in as:

    Friday 11/30/2018
    Fri 30/11/2018 2:00 PM
    30/11/2018
    December 30 2018
    etc
    etc

    Basically they are copied from outlook journals....so whatever someone has set up in there.

    How can I standardize that?

    Currently I have it working with Fri 30/11/2018 2:00 PM format.

    I just remove the "Fri" and the "2:00 pm" then sort unique values.

    I'm a pretty basic VBA programmer and a push in the right direction would be great.

    Thanks

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

    Re: Sorting inconsistent dates

    I suggest using a helper column with the formula =IF(ISNUMBER(A2),A2,DATEVALUE(A2)) assuming the dates you want are in column A.
    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: Sorting inconsistent dates

    In fact, if you just want to work with whole dates use: =INT(IF(ISNUMBER(A2),A2,DATEVALUE(A2))).

    DateValue will give you a whole date. The INT will strip off the time piece it A2 actually is a date.

  4. #4
    Registered User
    Join Date
    10-14-2010
    Location
    BC Canada
    MS-Off Ver
    Excel 365
    Posts
    77

    Re: Sorting inconsistent dates

    DATEVALUE Returns an error
    the cell is formatted as
    Tue 12/04/2018 12:45 PM

    I've also tried
    Please Login or Register  to view this content.
    But doesn't work with the format I'm using. I must be missing a formatting concept.

    Thanks

  5. #5
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Sorting inconsistent dates

    Quote Originally Posted by thisandthat View Post
    ... Problem is that everything ... get different formats ...
    Quote Originally Posted by thisandthat View Post
    ... the cell is formatted as
    Tue 12/04/2018 12:45 PM
    This is no problem ... this is ... nightmare ...

    This date 12/04/2018 - this is April or December ?
    Fortunately, there is the entry "Tue", then this is December ... but what if, in April and in December, it would be the same day of the week ?
    It could happen, it is not impossible.
    And what about such dates (if such were in sample), for example: 7/6/2018 and 6/7/2018, both dates without the given day of the week ?
    How to recognize a month here if, like you write, the date formats are different ?

    Based on this small data sample, this can be referred to as:
    ... highly disturbing with elements of exceptional dislocation of the possibilities of considering possibilities ... ... or something similar ...

    Quote Originally Posted by thisandthat View Post
    ... How can I standardize that? ...
    Attach a larger sample of data, maybe someone will come up with something.

  6. #6
    Registered User
    Join Date
    10-14-2010
    Location
    BC Canada
    MS-Off Ver
    Excel 365
    Posts
    77

    Re: Sorting inconsistent dates

    Gotcha,

    Well I'll just get everyone to enter consistent formats with their time sheets and go from there.

    Thanks

+ 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. Dates are incorrect due to inconsistent formats
    By tpar7322 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-10-2017, 12:53 PM
  2. [SOLVED] Merge inconsistent dates (stock prices from FTSE)
    By DSPorter in forum Excel General
    Replies: 2
    Last Post: 02-11-2015, 05:55 AM
  3. Converting from inconsistent dates in excel
    By muddaubere in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 08-04-2014, 04:58 PM
  4. Sorting inconsistent columns of text
    By Cheshire in forum Excel General
    Replies: 0
    Last Post: 11-10-2009, 09:09 PM
  5. Help! ISO formula for inconsistent monthly dates
    By Yeah in forum Excel General
    Replies: 12
    Last Post: 08-26-2006, 10:52 AM
  6. Help! ISO formula for inconsistent monthly dates
    By Yeah in forum Excel General
    Replies: 9
    Last Post: 08-22-2006, 06:30 PM
  7. Graphing inconsistent dates and data
    By Chuck Jurgens in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 08-28-2005, 11:05 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