Convert difference with dates and time to days hours amd minutes

Posted on 2012-09-20
Last Modified: 2012-09-20
I want to convert the difference between two cells which contain dates into days, hours and minutes.

30/7/2012 12:00
02/8/2012 13:15


3 Days 01:15

Can you give me a formula for this please?

Question by:GordonMasson
    LVL 39

    Expert Comment

    use formula

    then format that cell with the custom format
    d "Days" hh:mm

    Cells \ Format \ Format cells
    Number \ Custom \ type in the format I gave you


    Author Comment

    Hi Thomas

    Thats what i tried and when you do the calculation, the cell does give you the correct number of days.

    When you try to format it its fine if it doesnt roll over a month but when it does the format to d "Days" hh:mm is incorrect.

    30/07/2012 12:00
    02/08/2012 13:15

    will give you
    3Days 01:15

    30/07/2012 12:00
    02/09/2012 13:15

    will also give you
    3Days 01:15
    LVL 39

    Accepted Solution

    Then you can use this, knowing that it's no longer a number field and can't be added, sorted, etc. as such.

    =INT(A2-A1) & " Days " & TEXT(A2-A1,"hh:mm")


    Author Closing Comment

    Thanks Thomas

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
    How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now