+ Reply to Thread
Results 1 to 19 of 19

Overlapping tasks periods

  1. #1
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Overlapping tasks periods

    I come again to ask for help for the following problem:

    - I have a set of tasks that have a start date for the task and an end date for the task;

    - For this set of tasks I needed to know, by VBA, in an orderly way, which periods (date range) where there are more overlapping tasks;

    - In a first stage, the ordering of the data will be made, for the largest number of overlaps and within those of the one with the greatest overlapping days, that is, for periods with the same number of overlaps, the first is what has more days.

    I say that it is in a first phase since in fact the ordering will be done by calculating a new "WEIGHT" that will be equal to WEIGHT = A1 * D1 * A1 / 3, and the ordering will be from the highest to the lowest WEIGHT, as you can see in the data on the right in the “OUTPUT” tab.

    In the file I attach, I have a set of data, tasks and dates, and the expected results, number of overlapping tasks, date range and number of days.

    All help will be welcome
    Jorge Cabral

    PS: Also in https://www.ozgrid.com/forum/index.p...periods-dates/
    Attached Files Attached Files
    Last edited by JCabral; 01-21-2020 at 09:06 AM.

  2. #2
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Any help will be very welcome.

    Thanks
    Jorge Cabral
    Last edited by JCabral; 01-30-2020 at 07:41 PM.

  3. #3
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Any tip on this?

    Thanks
    Jorge Cabral

  4. #4
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Any help?

    Thanks
    Jorge Cabral

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,426

    Re: Overlapping tasks periods

    282 views and no bites suggests that either nobody understands what you are trying to do, or that what you are asking can't be done, or that nobody wants to help.

    You might try, instead of just bumping the thread, adding some extra detail.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Hi AliGW
    Thanks for your answer and suggestions, can you help me with that part?
    What is not understood in my request for help ?, What can I improve in the explanation? What is not clear from the example I attached?

    Thank you so much again
    Jorge

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Overlapping tasks periods

    Not sure that I understand but will make a guess that you would like the data in columns L:O put into an order as shown in columns A:D.
    Note that this is a formula based proposal, so if you are only looking for a VBA solution you may stop reading.
    As modeled in columns R:U
    The number of tasks column is populated using: =LARGE(L$2:L$74,ROWS(L$2:L2))
    The other columns are populated using: =INDEX(M$2:M$74,AGGREGATE(15,6,(ROW($L$2:$L$74)-ROW($L$1))/($L$2:$L$74=$R2),COUNTIFS($R$2:$R2,$R2)))
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  8. #8
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Hi JeteMc

    Thank you very much for your reply, but it is not what i need.

    The data I have, are in the "DATA" tab, columns "A" to "C". and are the start and end dates of certain tasks.

    Some of these dates overlap, and it is these overlap periods that I need to calculate.

    In the "OUTPUT" tab, columns "A" to "D", are the results I want, but these were calculated manually, to show what I want. So what I have is that, for example, between 10/22/2020 and 11/21/2020 there are 16 tasks that overlap in a total of 30 days.

    After this calculation is done, I need to sort according to the formula in column "P" and then sort from largest to smallest.

    I hope I have been clearer this time.

    Thank you so much again.
    Jorge

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Overlapping tasks periods

    I happened to be working more on this and think that I have what you want.
    To get the overlaps use: =SUM(COUNTIFS(B3:B$47,"<="&C2,C3:C$47,">="&B2),COUNTIFS(B$1:B1,"<="&C2,C$1:C1,">="&B2))
    To get the overlaps and dates in descending order:
    1. Overlaps: =LARGE(D$2:D$46,ROWS(D$2:D2))
    2. Dates: =INDEX(B$2:B$46,AGGREGATE(15,6,(ROW(B$2:B$46)-ROW(B$1))/($D$2:$D$46=$H2),COUNTIFS($H$2:$H2,$H2)))
    To get the number of days: =J2-I2+1
    Let us know if you have any questions.

  10. #10
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Hi JeteMc
    I think it was not clear what I want.
    As you can see from the gantt diagram, there is no overlap of 44 tasks, the maximum is actually 16 tasks.
    These are the task overlap periods that I want to be calculated.
    In the OUTPUT tab are the values expected and calculated manually.

    Thank you very much
    Jorge

  11. #11
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Overlapping tasks periods

    Try pasting the following into cell L2 and then double clicking the fill handle to copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  12. #12
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Hi JeteMc

    What that formula do? The formula is not given the period (Start and End, as seen in OUTPUT Column B and C)

    Have you see the file i have attach?

  13. #13
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Overlapping tasks periods

    I thought that the formula was supposed to be used with the dates in column M on the Output sheet, before the range was sorted using the formulas in post #7.
    In order to match the numbers that have been manually placed in column A modify the formula to read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Once entered into cell A2 on the Output sheet double click the fill handle to copy the formula down to A74.
    Let us know if you have any questions.

  14. #14
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: Overlapping tasks periods

    Pl see file.
    In F2
    Please Login or Register  to view this content.
    In G2 then copied to H2
    Please Login or Register  to view this content.
    In I2

    =H2-G2

    Copy down all.
    Last edited by kvsrinivasamurthy; 04-14-2021 at 02:56 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  15. #15
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Hi kvsrinivasamurthy

    I think there is a great deal of confusion with what I need.
    The data I have for this problem is what is in the "DATA" tab and which is the task number, the date each task starts and the date it ends. I don't have any more data.

    With this data I need to calculate the periods in which they overlap. If you look at the Gannt diagram you see that there are periods when there are overlapping dates and these are the periods that I need to calculate

    Everything in the OUTPUT tab is not data, it is results is what I need a macro to calculate. The data being ordered is not my main objective nor the purpose of this post

    thank you so much
    Jorge

  16. #16
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Overlapping tasks periods

    On the Data sheet the colored areas of the Gantt chart seem to correspond to the dates in columns B and C.
    There are numbers that correspond to the dates 10/22/2020 through 11/21/2020 which I assume are from the output sheet.
    There are 16 tasks that include those dates. The formulas that I provided for columns A (post #13) and L (post #11) on the Output sheet both yield 16, furthermore the formulas yield all of the values that are manually placed in those columns.
    Since neither of them seem to be what you want, I am confused as to what you want.

  17. #17
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    On the Data sheet the colored areas of the Gantt chart seem to correspond to the dates in columns B and C. – CORRECT

    There are numbers that correspond to the dates 10/22/2020 through 11/21/2020 which I assume are from the output sheet. - These numbers were to show you that between the dates of 10/22/2020 and 11/21/2020, there are 16 overlapping tasks. It was just an example. What I want to know is precisely all these intervals and the number of overlapping tasks. What is in OUTPUT was calculated manually based on the GANTT diagram, Columns A to C of the OUTPUT tab, I repeat, I made the gantt diagram as it is on DATA and then I went to see each period and the number of tasks and manually filled in the columns from A to C to show what I intend to be done by VBA.

    There are 16 tasks that include those dates. The formulas that I provided for columns A (post #13) and L (post #11) on the Output sheet both yield 16, furthermore the formulas yield all of the values that are manually placed in those columns. - It's not what I want, what I want are the overlap intervals and the number of overlapping tasks, columns A to C of the OUTPUT tab

    Since neither of them seem to be what you want, I am confused as to what you want. - I hope to have clarifies above


    Thank you so much
    Jorge


    Add new example explanation
    Attached Files Attached Files
    Last edited by JCabral; 04-14-2021 at 10:39 AM.

  18. #18
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Overlapping tasks periods

    Note: I was working on this when the file was added to post #17, so this proposal is based on the description in post #17 and the file attached to post #1.
    This is a formula based proposal. I do not know enough about VBA to say whether this could be accomplished using VBA.
    On the Data sheet E1:BRK1 are populated using: =IF(AND(E1<>"",SUM(E1,1)<=$C2),SUM(E1,1),"")
    E2:BRK46 are populated using: =IF(AND($B2<=E$1,$C2>=E$1),1,0)
    E48:BRK48 are populated using: =SUM(E2:E47)
    E49:BRK49 are populated using: =IF(AND(D48<>"",E48<>D48),E1,"")
    E50:BRK50 are populated using: =IF(AND(F48<>"",F48<>0,E48<>1,E48<>F48),E1,"")
    The results are shown in columns R:T on the Output sheet.
    Column R (no. of overlaps) is populated using: =IF(S2="","",INDEX(DATA!E$48:BRK$48,MATCH(S2,DATA!E$1:BRK$1,0)))
    Column S (start date) is populated using: =IF(T2="","",AGGREGATE(15,6,DATA!E$49:BRK$49,ROWS(S$2:S2)))
    Column T (end date) is populated using: =IFERROR(AGGREGATE(15,6,DATA!E$50:BRK$50,ROWS(S$2:S2)),"")
    I want to be sure that this is acceptable before proceeding to sorting the results.
    Let us know if you have any questions.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Overlapping tasks periods

    Hi JeteMc

    I want to thank you for your solution, but as you noticed the help request was placed in the topic "Excel Programming / VBA / Macros" from the beginning.

    The file I added in post # 17 is the same file I added in post # 1 and I just added graphically what I tried to put into words, because my English is not very good.

    Your solution implies many marginal calculations, and the need to make the timeline between the smallest and the largest date and the problem is that none of this is fixed, that is, the task list is not fixed, so your solution would have to have a lot of intervention until reaching the final solution, for which I thank you very much.

    Thank you very much
    Jorge

+ 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. Help with total number of days overlapping in two periods
    By hweld in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-04-2019, 12:16 PM
  2. [SOLVED] Finding overlapping date periods for specific variables
    By pickaside in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-12-2019, 10:00 AM
  3. [SOLVED] Lookup tasks and sort by date and exclude completed tasks
    By AlexSchmidt in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 10-19-2017, 04:47 PM
  4. Overlapping Times (in daily tasks)
    By blp_ in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-31-2014, 02:24 PM
  5. Replies: 0
    Last Post: 07-30-2012, 04:51 PM
  6. Merging Tasks w/ Parts ordered for tasks
    By code870 in forum Excel General
    Replies: 0
    Last Post: 06-19-2011, 01:43 PM
  7. Outlook Tasks - Adding tasks from a worksheet added today or after
    By dpotta in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-28-2010, 07:15 AM

Tags for this Thread

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