+ Reply to Thread
Results 1 to 5 of 5

Calculating the difference between dates

Hybrid View

  1. #1
    Registered User
    Join Date
    07-12-2010
    Location
    Battle, East Sussex
    MS-Off Ver
    Excel 2007
    Posts
    8

    Calculating the difference between dates

    Hello All,

    I wonder if anyone can help me, i am really struggling with this one! Basically i want to be able to take the received date/ time and compare it to the current date/time and give me a output of the difference.

    E.g.

    Receive Date - 07/07/2010
    Receive Time - 15:46:07

    Current Date - 12/07/2010
    Current Time - 19:16:37

    Difference Between - dd/mm hh:mm

    This may seem simple for one but i have over 10,000 of these to check, i am currently doing the following:

    In one cell i add up the receive date/time to give me it in one cell. In the next cell along i do =NOW() and in the next cell i minus the =NOW() cell from the cell i have put the receive date/time together.

    It doesnt seem to quite work, it doesnt seem to be able to calculate it when the difference between is less than a month, it puts it as 1 month and blah blah blah hours. I am really confused.

    Ignoring what i have done or not if the case, can someone come up with a solution as it will make my life soooo much easier at work.

    Thanks,
    Matt
    Last edited by matt20687; 07-12-2010 at 02:33 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,681

    Re: Calculating the difference between dates !?!?!?

    Hello Matt,

    Yes you are doing the correct calculation but formatting as dd/mm doesn't work because the mm always gives you calendar months, i.e. 1 to 12 whereas you need it to be 0 to 11

    Simplest way is to just subtract the dates and format as a number to get a decimal representation of the difference, e.g. showing 45 days 8 hours as 45.33 using

    =NOW()-A1-B1

    ....but if you want the result formatted to show days.....you could do the subtraction and just get days and hours like this

    =INT(NOW()-A1-B1)&" days "&TEXT(NOW()-A1-B1,"hh:mm")

    or use DATEDIF like this

    =DATEDIF(A1,TODAY()-(MOD(NOW(),1)<B1),"m")&" months "&DATEDIF(A1,TODAY()-(MOD(NOW(),1)<B1),"md")&" days "&TEXT(NOW()-A1-B1,"hh:mm")

    where A1 has your date and B1 your time
    Last edited by daddylonglegs; 07-12-2010 at 02:44 PM.
    Audere est facere

  3. #3
    Registered User
    Join Date
    07-12-2010
    Location
    Battle, East Sussex
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Calculating the difference between dates !?!?!?

    Hello,

    You are a star!!! Cant believe how good that works. Now the next question is, basically i will need to highlight any exams over 48 hours / 2 days. I would prefer it if i could run something on a separate sheet which pulls all of the one either on 48 hours / 2 days out.

    Any ideas?

    God i love this forum!!!

    Thanks again,
    Matt

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Calculating the difference between dates !?!?!?

    Hi,

    If you wanted to highlight on the same sheet, then using daddylonglegs first and second formulas (for some reason can't get it to work with the third) in first column D1 , the first formula, second column E1 second formula, then select second column and using conditional formatting > new rule > use a formula... and enter D1>2 then format your colour. Hide column E.
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  5. #5
    Registered User
    Join Date
    07-12-2010
    Location
    Battle, East Sussex
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Calculating the difference between dates !?!?!?

    Hello,

    That works great to highlight the ones i need, the only problem is that have 51,000 rows to do this for. Dont really want to have to copy and paste all exams that are highlighted. Is there no way i can pull the exams out into a new sheet that are older than 48 hours comparing from the receive date and the current date?

+ 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