+ Reply to Thread
Results 1 to 8 of 8

Difference between two Date and Times cell in Hours

  1. #1
    Registered User
    Join Date
    10-12-2010
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Difference between two Date and Times cell in Hours

    I've been searching around and most of the issues revolves around either fixed date and time entered into the vba code or suggestion to use some sort of format to extract the time information out.

    Attached is a sample work book for working.

    What I'd want to eventually achieve is to find the difference in Hours between the first cell (A1) that containts Date & Time and the last cell that contains Date & Time in this case cell A495. The data provided is dynamic - it may be longer or shorter.

    The difference in hours would then be copied to another cell say C1.

    Thanks in advance for viewing and for your suggested solutions.

    Kind Regards

    Sample2.xlsx

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Difference between two Date and Times cell in Hours

    Assuming the entries are in order

    =MAX(A:A)-MIN(A:A)

    with number format of [h]:mm
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Difference between two Date and Times cell in Hours

    if not in order than you can try this too..

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Difference between two Date and Times cell in Hours

    @Debraj Roy, if there not in order then you need a formula to replace -A1 to locate the min time.

  5. #5
    Registered User
    Join Date
    10-12-2010
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Difference between two Date and Times cell in Hours

    Quote Originally Posted by Andy Pope View Post
    Assuming the entries are in order

    =MAX(A:A)-MIN(A:A)

    with number format of [h]:mm
    This worked well even if the entries are jumbled up Thanks !

    It now shows e.g. 3:59 - Anyway that it could show the number 4 ? I understand that I cannot find the format under 'Customs' and there may not be away around this. Thanks.
    Last edited by kidengineer; 07-19-2013 at 05:44 AM.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Difference between two Date and Times cell in Hours

    order of entries does not affec the MIN/MAX formula. It's only if you specifically want to calculate the difference between 1st and last entry that you need to actually locate the last entry.

    And saying that I know realise my comment to Debraj Roy is completely redundent. My bad!

  7. #7
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Difference between two Date and Times cell in Hours

    Thanks for the guidance Andy..
    Agree.. noted and bowed...

  8. #8
    Registered User
    Join Date
    10-12-2010
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Difference between two Date and Times cell in Hours

    Nevertheless, Thanks for the help guys ! Learning never ends

+ 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. Required difference between two dates/times in hours
    By kasi.maddula in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-26-2013, 07:14 AM
  2. Need difference between two dates/times in hours
    By ramsdesk in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-25-2013, 01:25 PM
  3. Difference between 2 times (24 hours)
    By csynic in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-02-2011, 02:22 PM
  4. Calculating difference in times as hours and minutes
    By Andrea112233 in forum Excel General
    Replies: 3
    Last Post: 08-10-2009, 10:23 AM
  5. [SOLVED] HOURS DIFFERENCE IN TIME BETWEEN DIFFERENT DATES AND TIMES
    By tankerman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-13-2005, 12: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