+ Reply to Thread
Results 1 to 4 of 4

Intersection of dates

Hybrid View

  1. #1
    Registered User
    Join Date
    10-01-2007
    Posts
    2

    Intersection of dates

    Would there be any way to do this?

    Suppose A1 contains a date 11/14/2006 and A2, 12/13/2006. B1 now contains 11/20/2006 and B2, 12/23/2006.

    I would like to get how many days the interval B1 to B2 were contained in interval A1 to A2, which is for this case, 23 days. Thanks.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Does this work for you?

    =MIN(B1:B2)-MAX(A1:A2)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    10-01-2007
    Posts
    2
    yes thanks a lot!

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,705
    By my reckoning you have a 24 day overlap if you count all days from 20 Nov to 13th December inclusive. Using your counting method, if one period ended on the same day as the other started then you'd get zero, is that the requirement?

    If so, then to cater for the possibility that there is no overlap, or that one period is wholly contained within the other try

    =MAX(0,MIN(A2,B2)-MAX(A1,B1))

    or if you want to get a result of 24 as suggested

    =MAX(0,MIN(A2+1,B2+1)-MAX(A1,B1))

+ 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