+ Reply to Thread
Results 1 to 5 of 5

Overlapping Time Based on Conditions

  1. #1
    Registered User
    Join Date
    01-19-2017
    Location
    columbus, ohio
    MS-Off Ver
    Office 2010
    Posts
    2

    Overlapping Time Based on Conditions

    I have a report showing when an error light is above a set of conveyors. I want to figure out how much time a group of conveyors is down.

    Lane 1 and 2 are run by Team 1
    Lane 3 and 4 are run by Team 2
    Lane 5 and 6 are run by Team 3
    ....
    Lane 15 and 16 are run by Team 8
    ....
    Lane 23 and 24 are run by Team 12

    What I want to know, is for what length of time does each team have an error on both of their conveyors.

    Capture.PNG

    In the example I highlighted, Lane 5 and 6 both have error lights which overlap by 1.433 minutes.
    Attached Files Attached Files

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

    Re: Overlapping Time Based on Conditions

    Welcome to the forum! See if the attachment does the trick. I reformatted your sheet to display seconds in columns B and C, then I added a helper column labeled "Team" in Column F with a table off to the side to help match each entry to the associated team. The real work occurs in column G, which uses the following formula in G2, filled down through G357:

    =IF(COUNTIFS($C$2:$C2,">"&$B2,$B$2:$B2,"<"&$C2,$F$2:$F2,$F2)>1,MIN(SUMPRODUCT(--($C$1:$C1>$B2),--($B$1:$B1<$C2),--($F$1:$F1=$F2),($C$1:$C1)),$C2)-$B2,"")

    This should show the overlap time in the row of the second of the two overlapping entries. I didn't check every entry, but it seemed to work on the ones I looked at. Take a look, hopefully it helps...


    EDIT: Better solutions below
    Attached Files Attached Files
    Last edited by CAntosh; 01-19-2017 at 06:11 PM. Reason: shame.

  3. #3
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Overlapping Time Based on Conditions

    another way with min(ends)-max(starts)
    Attached Files Attached Files

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

    Re: Overlapping Time Based on Conditions

    Looking at Tim's solution, he made much better use of column D than I did. I overlooked the fact that my helper column already existed; there really wasn't any need for me to create the extra column and table. My cleaner version would look like this:
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-19-2017
    Location
    columbus, ohio
    MS-Off Ver
    Office 2010
    Posts
    2

    Re: Overlapping Time Based on Conditions

    thanks to both of you for the super fast solution!! Made my life a lot easier!

+ 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] Calculating # of Overlapping days with several date ranges and conditions
    By ZafferAhmed in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-30-2021, 05:44 AM
  2. [SOLVED] Sum time spent based on conditions
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-02-2015, 05:43 AM
  3. Replies: 1
    Last Post: 11-14-2013, 08:45 AM
  4. Count based on date/time conditions
    By lrmorales87 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-20-2012, 01:08 AM
  5. Replies: 1
    Last Post: 10-30-2012, 07:12 PM
  6. [SOLVED] Formula based upon time data with conditions
    By halfpint123 in forum Excel General
    Replies: 4
    Last Post: 09-28-2012, 12:41 PM
  7. Counting Overlapping Time & Non-Overlapping Time
    By I_need_help1 in forum Excel General
    Replies: 4
    Last Post: 02-08-2011, 02:36 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