+ Reply to Thread
Results 1 to 4 of 4

Sorting by "Difference" results between two Date/Time fields

  1. #1
    Registered User
    Join Date
    07-08-2011
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    11

    Sorting by "Difference" results between two Date/Time fields

    We have two date/time fields that we determine the number of hours between. Sometimes it may be a negative result, others not (eg. were you early or late?).

    Timestamp A: 04/01/13 18:00
    Timestamp B: 03/27/13 6:40

    RESULT: Timestamp A - Timestamp B = 131.33 hours

    We have tons of these calculations and we want to sort the table by the RESULTS from smallest time difference to largest.
    When we sort by that column descending, it absolutely will not sort correctly and I now it has something to do with the fact that we're using date/time fields. I've always struggled with them!! If anyone can tell me how to:

    1. determine the hour difference from one timestamp to the next, and
    2. sort the dataset by the results of that column of calculations...

    I would GREATLY appreciate it!!

    Rita Brasher
    Project Engineer
    FedEx Express

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Sorting by "Difference" results between two Date/Time fields

    If timestamp A is in col A and B is in B, in C

    =(A2-B2)*24
    You should be able to sort on Col C. What is not working? Can you upload a spreadsheet (Go Advanced> Manage Attachments)?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,447

    Re: Sorting by "Difference" results between two Date/Time fields

    If you have problems with dates and times, this link will help

  4. #4
    Registered User
    Join Date
    07-08-2011
    Location
    Memphis, TN
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Sorting by "Difference" results between two Date/Time fields

    We figured out that the problem was using calculated date/time fields. She was adding time to existing fields, so Excel didn't like it. Once we "Copy/Paste Special...Values" and then did the calculations and sort, everything worked out perfectly...

    Thanks for your replies, ChemistB and Pepe!!

+ 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