+ Reply to Thread
Results 1 to 5 of 5

Overlapping dates in range

Hybrid View

  1. #1
    Registered User
    Join Date
    01-05-2011
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    2

    Overlapping dates in range

    Hi to all,

    I have a problem with orverlapping dates in range.

    I have a list of employees absences (some starting / ending in one month, others not)
    I need to find out how many days of absence each employee had in each month

    I already tried to use standard formula (max(min(end,end)-max(start,start)+1,0)) but it works only for one record (I can have multiple rows for one employee)

    Please do you have any idea, how to solve this (just for info: there is no chance that the dates of one employee will overlap (if there are multiple records per employee)

    Overlapping dates in range.PNG

    thank you very much for any advice.

    Mike

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Overlapping dates in range

    Hi there.

    A picture is worth 1,000 words. An Excel sheet is worth 1,000 non-editable pictures.

    Please read the yellow banner about sample worksheets, at the top of the screen. Act on its guidelines and post a SMALL sample sheet complete with an explanation and some expected results.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Overlapping dates in range

    Well, this is your first post here, so I did it for you and retyped your table (althought as suggested by Glenn it would be nice if you just would attach the workbook).
    I inserted data in an Excel Table so if you add new absences below, the table will auto expand.
    Then used PowerQuery to produce a connection and transform content of this table and finaly used this connection as a source in Pivot Table.

    The only thing left for you is the formatting of dates (especially if you see polish names of months sty, lut, mar ,...). And may be removing total rows and column (althought I think they are useful too).

    So the usage is: once you add new data to list of absences, rightclick on any column in the pivot table and refresh it.

    The listing of the PQ connection is as follows:
    let
        Source = Excel.CurrentWorkbook(){[Name="Tabela1"]}[Content],
        #"Change Type using Local Settings" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Start", type date}, {"End", type date}}, "pl-PL"),
        Added_column_with_all_single_days = Table.AddColumn(#"Change Type using Local Settings", "Single_days", each List.Dates([Start], Duration.TotalDays([End]-[Start])+1, #duration(1, 0, 0, 0))),
        Expanded_Single_days_column = Table.ExpandListColumn(Added_column_with_all_single_days, "Single_days"),
        #"Change Type2" = Table.TransformColumnTypes(Expanded_Single_days_column, {{"Single_days", type date}}, "pl-PL"),
        #"Use End of Month" = Table.AddColumn(#"Change Type2", "End of Month", each Date.EndOfMonth([Single_days]), type any),
        #"Change Type3" = Table.TransformColumnTypes(#"Use End of Month", {{"End of Month", type date}}, "pl-PL"),
        Delete_unneded_columns = Table.RemoveColumns(#"Change Type3",{"Start", "End", "Single_days"})
    in
        Delete_unneded_columns
    Attached Files Attached Files
    Last edited by Kaper; 01-03-2022 at 05:14 AM.
    Best Regards,

    Kaper

  4. #4
    Registered User
    Join Date
    01-05-2011
    Location
    Slovakia
    MS-Off Ver
    Excel 365
    Posts
    2

    Re: Overlapping dates in range

    thank you very much for all your help, next time I will add file directly (really sorry for this)

    For some reasons I am not able to download the file you attached (I already contacted admin).

    Once again, thank you

    Michal

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Overlapping dates in range

    Hi,

    I packed the file as a zip archive. May be it will make downloading easier/possible
    Attached Files Attached Files

+ 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. Combining Overlapping Dates between Unique ID & Identify Overlapping with Other Date Range
    By bihaequipinc in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 09-28-2021, 02:11 AM
  2. [SOLVED] Overlapping dates
    By Berna11 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-26-2019, 05:08 AM
  3. [SOLVED] Overlapping Dates....
    By raghuprabhu in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-19-2017, 01:56 AM
  4. [SOLVED] Overlapping Dates, Gaps in Dates, Double Counting
    By arunkushvaha in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 11:15 PM
  5. Overlapping Dates per Name
    By ENDO123 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-02-2013, 09:24 AM
  6. Overlapping Dates, Gaps in Dates, Double Counting
    By sglxl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2012, 02:46 AM
  7. Identifying Overlapping Dates within a range
    By Tremain in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-09-2005, 06:06 PM

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