+ Reply to Thread
Results 1 to 4 of 4

How to calculate hours between 2 dates.

  1. #1
    Forum Contributor
    Join Date
    10-27-2019
    Location
    London
    MS-Off Ver
    365
    Posts
    179

    How to calculate hours between 2 dates.

    I have 2 cells with long date with time.

    For example

    Cell A1 contains 1 02 2023 17:58:02
    Cell A2 contains 2 02 2023 9:38:17


    What function can I use to get the difference in hours and minutes?

    I tried =A1-A2 but got no result. I had the cellels formatted as date.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: How to calculate hours between 2 dates.

    use Power Query

    Column1 Column2 Subtraction
    01/02/2023 17:58
    02/02/2023 09:38
    0.15:40:15


    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: How to calculate hours between 2 dates.

    I tried =A1-A2 but got no result. I had the cellels formatted as date.
    A1-A2 should have worked -- as long as the dates were numbers. If A1-A2 does not work, it is most likely because the "dates" are really text strings (number formatting cannot change the cell value, so it cannot make a number stored as text a number). The key step in this operation, then is converting the dates stored as text to real numbers that Excel can work with. Power Query is one way. Other strategies are here: https://support.microsoft.com/en-us/...1-c5bad0f0a885 Some strategies depend heavily on your system's regional settings for what a date will look like.

    Several different ways to do this, but you need to get your dates stored as numbers and not text to make it easier for Excel to work with your dates.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

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

    Re: How to calculate hours between 2 dates.

    Perhaps
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and format as time

+ 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] Calculate hours elapsed between two dates
    By hasan mougharbel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-18-2022, 05:57 AM
  2. Calculate hours between 2 dates - exclude weekend hours
    By awhitworth in forum Excel General
    Replies: 4
    Last Post: 05-26-2015, 03:32 AM
  3. Replies: 2
    Last Post: 03-02-2013, 10:57 AM
  4. Calculate working hours between two dates
    By nirmala.seetharaman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-19-2012, 06:36 AM
  5. calculate hours between two dates
    By mmishra27 in forum Excel General
    Replies: 0
    Last Post: 02-08-2011, 07:25 AM
  6. Calculate hours between two dates
    By sivanvega in forum Excel General
    Replies: 4
    Last Post: 01-01-2010, 11:47 PM
  7. [SOLVED] Calculate work hours between two dates
    By trixiebme in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2005, 04:06 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