+ Reply to Thread
Results 1 to 7 of 7

find out overlap time

  1. #1
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    find out overlap time

    Hi,
    I'd like to find overlap time in time sheet.
    I hope my table looks like below;
    Date Start Time End Time Overlap?
    12/5/2016 11:00 15:00 Yes
    12/5/2016 12:00 13:00 Yes
    12/6/2016 11:00 13:00 No

    How can I use formula for 12/6/2016?
    Because I can know 'Overlap' for the same date, 12/5/2016, using =IF(SUMPRODUCT((A2<$B$2:$B$5)*(B2>$A$2:$A$5))>1,"Yes","No"), but I also get 'Yes' for 12/6/2016.
    How can I adjust this Sumproduct formula to get 'No' on 12/6/2016?
    Thanks.
    Last edited by Goodstart14; 12-07-2016 at 11:35 AM.

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: find out overlap time

    Not sure if I'm 100% clear on what you're after, but I went with COUNTIFS. Specifically:

    =IF(COUNTIFS($A$2:$A$8,$A2,$C$2:$C$8,">"&$B2,$B$2:$B$8,"<"&$C2)>1,"Yes","No")

    ...in D2, with Date | Start | End in A,B, and C. Check out the attachment and see if it does the trick.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: find out overlap time

    Thanks for your help.
    It seems working except '0:00', midnight.
    Instead '24:00", I use '0:00' in the drop down in Start Time and End Time.
    When I play with 0:00, then it's not right.

  4. #4
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: find out overlap time

    Yeah, Excel considers 0:00 to be the start of a day. You could either use 23:59 for midnight instead, or you could replace the formula I proposed with one that should take into account the 0:00 entries:

    =IF(COUNTIFS($A$2:$A$8,$A2,$C$2:$C$8,">"&$B2,$B$2:$B$8,"<"&$C2)+COUNTIFS($A$2:$A$8,$A2,$C$2:$C$8,TIME(0,0,0),$B$2:$B$8,"<"&$C2)+IF(AND($C2=TIME(0,0,0),COUNTIFS($A$2:$A$8,$A2,$C$2:$C$8,">"&$B2)>=1),2,0)>1,"Yes","No")

    Try it out, see if it holds up...
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: find out overlap time

    Thanks!!
    It worked.
    I want to put this formula in VBA, but I can't.
    Specially below part;

    IF(COUNTIFS($A$2:$A$8,$A2,$C$2:$C$8,">"&$B2

    I added quote at ">", so it looks like "">"".
    How about '&$B2' ? How can I write this in vba?

    Thanks

  6. #6
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: find out overlap time

    Usually the surest way to figure out how to translate a formula to VBA is to record a macro of yourself entering the formula in a cell, then look at the syntax of the recorded macro. My effort returned this:

    Please Login or Register  to view this content.
    R1C1 isn't my favorite thing, but the recording takes the strain off of figuring out where all of the quotes need to go.

  7. #7
    Forum Contributor
    Join Date
    11-21-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: find out overlap time

    Thanks for your help!

+ 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. [SOLVED] Overlap between two time ranges
    By LondonJames in forum Excel General
    Replies: 11
    Last Post: 07-12-2019, 02:18 AM
  2. Total time on overlap
    By aanaduta in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-04-2015, 08:12 PM
  3. [SOLVED] Time overlap
    By aanaduta in forum Excel General
    Replies: 6
    Last Post: 09-15-2015, 12:13 PM
  4. [SOLVED] Overlap for Date/Time
    By Brawnystaff in forum Excel General
    Replies: 2
    Last Post: 06-19-2015, 10:35 PM
  5. Time overlap %
    By sfire184 in forum Excel General
    Replies: 5
    Last Post: 09-09-2014, 02:23 AM
  6. [SOLVED] determine total overlap time when there are gaps in overlap (4 date ranges)
    By miriambender in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-12-2014, 11:58 PM
  7. Replies: 0
    Last Post: 08-14-2013, 11:21 AM

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