+ Reply to Thread
Results 1 to 18 of 18

dates overlap dynamic

  1. #1
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    dates overlap dynamic

    I need to calculate leaves (X, Y ) during a specified task by an employee.


    Task Workdays
    Start (Column D ) << >> End (Column E ) ------ Leaves days (column F )
    1 10/10/2015 <<>> 11/15/2015 ---- X
    2 11/27/2015 <<>> 12/27/2015 ---- Y
    3. task3 (Start dt. <<>> End Dt. ) ------ Z
    4. task4
    5..... 2/5/2016 2/5/2015....


    The leaves /Period :
    Leaves
    Column G << >> Column H
    Start <<>> End
    10/4/2015 <<>> 10/10/2015
    11/10/2015 <<>>11/13/2015
    12/2/2015 <<>> 12/8/2015
    2/24/2015<<>> 1/1/2016
    2/5/2016 <<>> 2/5/2015
    and so on.......

    The task list will be ever increasing, and so will be the leaves .

    i need to find leaves taken during the the task 1 (X ) , similarly for task 2 (Y )
    the leaves table will be say 200 rows to start with and gradually scalable, same with task list
    also need to account workdays only (remove week ends )
    Attached Files Attached Files
    Last edited by shishm; 12-23-2015 at 05:01 AM.

  2. #2
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,937

    Re: dates overlap dynamic

    What would be expected result ??? Can you make some sense clear once??

    Regards,
    Ankur

  3. #3
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: dates overlap dynamic

    if you open the excel you will have clear idea, Expected result X - 4 days, Y - 7 days, exclude weekends only work days to be considered.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    I think you will need a VBA solution for this.

  5. #5
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: dates overlap dynamic

    I believe that it can be done using MMULT , SUM , Index, ROW in array formula, however i am not familiar in formulating one myself

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    Well beyond my capabilities!

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    See attached: VBA will need to be adjusted to your worksheet data format.

    Function

    =LEAVES(B3,C3)



    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: dates overlap dynamic

    I opened your sheet, the sheet works when i change the dates on the task range, i get the desired results, however when i changed the leaves dates range it did not change at all. also both date ranges are pulled from different sources to this one sheet. and as of now there are 300 rows for task, which will be increased as per new task
    Also this sheet will be used both on excel and also google spreadsheet.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    I cannot offer a formulaic solution so you will have to hope someone can provide one.

    I don't understand the comment about the "Leaves" dates: all the routine does is use these dates to determine valid leave data. It is the task dates that cause changes using the function.

    The range of 300 rows is immaterial as the macro automatically extends the "Task Dates" it processes. You only have to drag the formula down.

  10. #10
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: dates overlap dynamic

    theres one post who has done this, trying to figure out how to do it for workdays, he has not done it for workdays

    http://www.get-digital-help.com/2015...e-date-ranges/

    also it gives different result in google spreadsheet

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    I have looked at the formula but I have no idea how to "convert" it to workdays.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    See attached sheet2

    Formula is ..

    =SUMPRODUCT((IFERROR((MMULT(TRANSPOSE($E$2:$E$6^0),(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1)>=$D$2:$D$6)*(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1)<=$E$2:$E$6)))^0,0))*(WEEKDAY(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1),2)<6))
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: dates overlap dynamic

    Yes John the formula gives correct result, what you did is excellent , still two issues to it, 1.) as i said date range in column - D and E, can go up to 300 rows, when try to increase this to cover 300 rows, it shows 0 value., as of now the out of this 600 rows much is blank and will be filled gradually 2.) also i need the same to work on google spreadsheet too.

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    This formula uses dynamic named ranges for "Leave Start" and "Leave End". As I said before the entries in D and E have no direct bearing on the results which are dictated by what is in A & B. I extended entries in D & E to over 300 and everything was OK.

    for "Leave_End" named range ...: "Leave_Start" change E to D

    =OFFSET(Sheet2!$E$2,0,0,COUNTA(Sheet2!$E:$E)-1,1)

    Post a file showing errors.

    I nothing about Google spreadsheets so cannot help on this.

    =SUMPRODUCT((IFERROR((MMULT(TRANSPOSE(Leave_End^0),(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1)>=Leave_Start)*(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1)<=Leave_End)))^0,0))*(WEEKDAY(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1),2)<6))

  15. #15
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: dates overlap dynamic

    thanks John, i did create 300 rows and checked, i need to fill all the 300 rows in column - D and E for the formula to work, so i made a dummy date range (earlier dates ) to check, so results correct, however my dates in column D & E , will only be there as and when they are punched, normally the cells will be blank. whereas the formulas in row C will be filled for all the 300 rows so that calculation is dynamic. any suggestions apart from filling dummy dates. if not then i will have to work around with dummy dates.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    I am confused about which dates are which: assuming task dates are A & B ,C is calculation , D & E are Leave dates then in C

    =IF(A2="","",SUMPRODUCT((IFERROR((MMULT(TRANSPOSE(Leave_End^0),(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1)>=Leave_Start)*(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1)<=Leave_End)))^0,0))*(WEEKDAY(TRANSPOSE($A2+ROW($A$1:INDEX($A:$A,$B2-$A2+1))-1),2)<6)))

    Enter with Ctrl+Shift+Enter

    Simply really!

  17. #17
    Registered User
    Join Date
    12-23-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: dates overlap dynamic

    thanks John, couldn't have been possible without you, will save lots of effort for me, thanks

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,514

    Re: dates overlap dynamic

    Thank you for feedback.

    I learned a lot myself trying to find a solution (with your help pointing to the Forum with the basis for the final solution).

+ 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. Conditional formatting rule to see if any booking dates overlap
    By lawrencef in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-25-2015, 01:08 AM
  2. [SOLVED] Count Start and End Dates that Overlap Specified Date Range
    By DigDoug in forum Excel General
    Replies: 8
    Last Post: 06-11-2014, 09:46 AM
  3. [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
  4. Replies: 0
    Last Post: 08-14-2013, 11:21 AM
  5. Find duplicate / overlap (-ping) dates in data
    By samcdavies in forum Excel General
    Replies: 4
    Last Post: 06-23-2012, 06:54 AM
  6. Conditional Formatting with Dates:overlap
    By Thayin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-10-2009, 01:18 AM
  7. Calculate Total Time when Dates/Times Overlap
    By Steve Gilley in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2008, 07:43 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