+ Reply to Thread
Results 1 to 8 of 8

Calculate number of days between two dates and time

Hybrid View

  1. #1
    Registered User
    Join Date
    05-31-2014
    Location
    Redmond, WA
    MS-Off Ver
    2007-2010
    Posts
    15

    Calculate number of days between two dates and time

    Please help I have a glitch on my formula when I calculated the number of days that had a grace period of 32 minutes. After 32, it should round up to 1 day. see attached file.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    02-09-2014
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    84

    Re: Calculate number of days between two dates and time

    340997d1408911932-calculate-number-of-days-between-two-dates-and-time-no.-of-day-calculation.xlsx
    Try this:
    =DATEDIF(A7,B7,"d")
    =DATE(YEAR(B7),MONTH(B7),DAY(B7))-DATE(YEAR(A7),MONTH(A7),DAY(A7))

  3. #3
    Registered User
    Join Date
    05-31-2014
    Location
    Redmond, WA
    MS-Off Ver
    2007-2010
    Posts
    15

    Re: Calculate number of days between two dates and time

    Hi vogel997,

    First, I would like to thank you for helping but when I tried and the formula does not work for the time that exceed 33 minutes between check in/out time. For example, the below 6/23/11 21:52 and 6/27/11 22:56 is 48 minutes (56-8) that exceed 33 minutes and I would like to the result it round up to 5 days

    Should = to Formula
    DateOut DateIn # of Day Return
    6/10/11 17:33 7/6/11 17:52 26 27 Not working 26 26
    6/26/11 10:58 6/29/11 11:19 3 4 3 3
    6/26/11 10:52 6/29/11 11:21 3 4 3 3
    6/21/11 18:16 6/27/11 18:24 7 7 6 6
    6/23/11 21:52 6/27/11 22:56 5 5 <-- four days and 2 min?? Should be 5 days because it's over 33 minutes 4 4
    6/24/11 11:01 6/28/11 11:03 5 5 4 4
    6/20/11 13:46 6/28/11 13:48 9 9 8 8


    Revision
    5/11/12 12:01 5/14/12 13:12 4 3
    5/8/12 10:42 5/15/12 12:32 8 7
    5/9/12 10:44 5/16/12 12:15 8 7

  4. #4
    Registered User
    Join Date
    02-09-2014
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    84

    Re: Calculate number of days between two dates and time

    340997d1408911932-calculate-number-of-days-between-two-dates-and-time-no.-of-day-calculation.xlsx

    Revised both formulas with the 33 min.

    let me know if it works.

    =DATEDIF(A3,B3,"d")+IF((B3-INT(B3))-(A3-INT(A3))>(32/60/24),1,0)
    =DATE(YEAR(B3),MONTH(B3),DAY(B3))-DATE(YEAR(A3),MONTH(A3),DAY(A3))+IF((B3-INT(B3))-(A3-INT(A3))>(32/60/24),1,0)
    Last edited by vogel997; 08-24-2014 at 06:07 PM.

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

    Re: Calculate number of days between two dates and time

    Try this formula for the number of days

    =CEILING(B3-A3-"0:32",1)
    Audere est facere

  6. #6
    Registered User
    Join Date
    05-31-2014
    Location
    Redmond, WA
    MS-Off Ver
    2007-2010
    Posts
    15

    Re: Calculate number of days between two dates and time

    Fantastic! both formula from daddylonglegs and vogel997 is working great.

    Thank you so much.

  7. #7
    Registered User
    Join Date
    08-25-2014
    Location
    Bangalore
    MS-Off Ver
    2007
    Posts
    2

    Re: Calculate number of days between two dates and time

    hi all,

    I have a query,, i need to calculate the last 7days data for calculation, based on date. need formula for this.

    regards
    Shukur

  8. #8
    Registered User
    Join Date
    05-31-2014
    Location
    Redmond, WA
    MS-Off Ver
    2007-2010
    Posts
    15

    Re: Calculate number of days between two dates and time

    Do you have a sample that we are able to help? Have you tried the formula from daddylonglegs and vogel997

+ 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. Calculate number of days between two dates
    By alexlund in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-29-2014, 05:52 PM
  2. Calculate number of days between 2 dates & then assign a number based on the answer
    By MrHappyGoLucky12 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-27-2014, 09:20 PM
  3. Replies: 4
    Last Post: 09-06-2012, 07:05 PM
  4. calculate number days between dates less Sat and Sun
    By maacmaac in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-26-2010, 11:09 AM
  5. calculate number of days btw dates
    By Nelson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-01-2006, 09:02 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