+ Reply to Thread
Results 1 to 4 of 4

Date formula problems - Excel 2003

  1. #1
    Registered User
    Join Date
    04-14-2009
    Location
    Rochdale, England
    MS-Off Ver
    Excel 2016
    Posts
    9

    Question Date formula problems - Excel 2003

    Hello All

    I will try to make this problem as simple as i can to understand but bear with me.

    I have a calculation in excel to work out how much time has passed between two sets of dates and times. my dates and times are in the same cell and are set out like this

    Please Login or Register  to view this content.
    this works ok however when i come to display the result of two dates and times months apart i get an odd result. for example:

    Please Login or Register  to view this content.
    if i try to subtract 1 from the reult it subtracts from the day only. anyone got any ides as to what i can do to resolve this? (i could split the cells into date and time but that will make things further complicated.)

    Thanks

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Date formula problems - Excel 2003

    use date.diff
    =DATE.DIFF(A1,A2,3) where a1 earliest date a2 latest date the 3 is to display in ymd
    but i think its part of the more functions addin.!
    there is the hidden function(well i cant see it in excel2003)
    of DATEDIF (notice! no full stop )
    see here
    http://www.cpearson.com/excel/datedif.aspx
    or
    http://www.meadinkent.co.uk/xl_birthday.htm
    for how to use it
    Last edited by martindwilson; 04-14-2009 at 09:02 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: Date formula problems - Excel 2003

    d and m formats are really designed for calendar months so m is always at least 1 (and won't exceed 12 even if your dates are more than a year apart). You can use this formula to get months, days and hours/minutes

    =DATEDIF(A2,B2-(MOD(B2,1)<MOD(A2,1)),"m")&" months "&DATEDIF(A2,B2-(MOD(B2,1)<MOD(A2,1)),"md")&" days "&TEXT(B2-A2,"hh:mm")

    assuming start time/date in A2 and end time/date in B2

  4. #4
    Registered User
    Join Date
    04-14-2009
    Location
    Rochdale, England
    MS-Off Ver
    Excel 2016
    Posts
    9

    Re: Date formula problems - Excel 2003

    works a treat. thanks.

    Sorry to be a pest but how can i get the average time from this now? i have a number of fields containing this date difference but i need to get the average, max and min from them.

    Thanks
    Last edited by lembi2001; 04-14-2009 at 11:51 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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