+ Reply to Thread
Results 1 to 19 of 19

How to find Sum of # of days w/o counting overlapping days twice

Hybrid View

  1. #1
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Glad to help Lanksout. Definitely an interesting challenge for me.

    If this resolves your query, can you please change the thread title to SOLVED by clicking on Thread Tools above your original post and click Mark this thread as solved.

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Yes this is interesting and challenging. Arrived at a different approach.


    Row\Col
    A
    B
    C
    D
    E
    1
    Start End
    2
    **1/6/2015
    1/10/2015
    0
    0
    Array-entered C2 : {=SUM(IF(FREQUENCY(ROW(INDIRECT($A2&":"&$B2)),IFERROR(ROW(INDIRECT($A1&":"&$B1)),0))=1,1,0))+$C1}
    3
    **1/13/2015
    1/20/2015
    0
    0
    D2 : =SUM($C$2:$C2)
    4
    **1/12/2015
    1/22/2015
    7
    7
    5
    **1/18/2015
    1/25/2015
    12
    19
    Last edited by FlameRetired; 08-09-2015 at 11:38 PM.
    Dave

  3. #3
    Registered User
    Join Date
    07-19-2015
    Location
    NONE
    MS-Off Ver
    Excel
    Posts
    9

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Thanks Dave! I will check out this approach.

    For now changing the thread to Solved.

  4. #4
    Registered User
    Join Date
    07-19-2015
    Location
    NONE
    MS-Off Ver
    Excel
    Posts
    9

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Dave,

    I couldn't get the formula to work. Its throwing in a pretty large value (number of days).

    I have around 233 rows. I entered the array in row 3 (changed the values accordingly) and copied it down. Row 1 has the table header and the array was giving an error in Row2 (#Value). Also entered SUM function in Row 3 (next column) and copied it down. It didn't work. Hopefully I am doing it right.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: How to find Sum of # of days w/o counting overlapping days twice

    I can not say without seeing a small workbook example, but the first row of the formula references row 1 which is understood to have column headers. That is why

    "IFERROR(ROW(INDIRECT($A1&":"&$B1)),0)"

    is the second argument of the IF function. A #REF! error is anticipated and assigned a 0 value. I don't know where the #Value error is coming from.

    Can you upload an actual workbook example --- a small one, but large enough to demonstrate what you are describing?

    Oh yes. Are you certain that the dates you are referencing are actual dates and not text that looks like dates? Been there done that.
    Last edited by FlameRetired; 08-10-2015 at 01:28 PM. Reason: typos / clarity

  6. #6
    Registered User
    Join Date
    07-19-2015
    Location
    NONE
    MS-Off Ver
    Excel
    Posts
    9

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Hi Dave,

    Please find the attached file. I want to calculate the total duration (counting overlaps only once) without filter and also after filtering by Items column. E.g. select only item 1 and find its duration (counting overlap only once). Hopefully this gives a better picture.


    CountDaysWithoutOverlap1.xlsx

    Thanks
    Last edited by lanksout; 08-11-2015 at 12:26 AM.

  7. #7
    Registered User
    Join Date
    07-19-2015
    Location
    NONE
    MS-Off Ver
    Excel
    Posts
    9

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Hi Quekbc,

    I am encountering one issue. The "Not Hidden" column is causing some issues with excel filter.

    Please see the attached excel file. I have named "Not Hidden" as Dummy. If I try filtering by Item - e.g. select only Item 1 the filter doesn't work properly. I narrowed the issue down to the "Dummy" column. But don't know how to correct it. The formula works perfectly as long as there is no filter applied.

    It would be very helpful if you can suggest a solution.

    Attached excel file
    CountDaysWithoutOverlap2.xlsx

    Thank You

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2503
    Posts
    13,702

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Late Edit: These results (column G) can't be right. There are only 112 days in the entire range.

    I have not checked these results extensively. (I have now.) They are below. Bearing in mind what quekbc observed please check this out. The errors occurred because wrong cell/range references were in the latest upload. What was there pertained to the previous upload. That part has been corrected here, but check the results. Quekbc has a good point and I haven't found a work-around for that yet.

    BTW this is without filtering. I am not sure I understand how you want this to behave when filtered.

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    1
    Buy Date Sell Date Item Buy Price Sell Price Array Duration Column1
    2
    11/3/2011
    11/12/2011
    Item 1
    120.19
    115.16
    0
    0
    Array enter in F2 :{=SUM(IF(FREQUENCY(ROW(INDIRECT($A2&":"&$B2)),IFERROR(ROW(INDIRECT($A1&":"&$B1)),0))=1,1,0))+N($F1)}
    3
    11/28/2011
    12/8/2011
    Item 2
    78
    76.52
    0
    0
    In G2 :=SUM($F$2:$F2)
    4
    12/16/2011
    12/28/2011
    Item 3
    53.1
    53.98
    0
    0
    5
    12/20/2011
    12/28/2011
    Item 2
    16.87
    17.19
    9
    9
    6
    12/21/2011
    12/28/2011
    Item 2
    47.49
    46.97
    17
    26
    7
    12/22/2011
    12/28/2011
    Item 1
    80.97
    81.15
    24
    50
    8
    12/22/2011
    12/28/2011
    Item 1
    49.66
    49.12
    31
    81
    9
    12/20/2011
    1/11/2012
    Item 2
    82
    85.08
    37
    118
    10
    12/21/2011
    1/12/2012
    Item 3
    68.4
    69.79
    60
    178
    11
    12/20/2011
    1/26/2012
    Item 3
    20.66
    22.16
    82
    260
    12
    1/17/2012
    1/27/2012
    Item 1
    124.62
    126.45
    93
    353
    13
    1/18/2012
    1/30/2012
    Item 2
    71.08
    71.14
    103
    456
    14
    2/13/2012
    2/15/2012
    Item 1
    37.48
    36.8
    103
    559
    15
    12/22/2011
    2/22/2012
    Item 2
    125.27
    136.03
    105
    664
    Last edited by FlameRetired; 08-11-2015 at 02:01 AM.

  9. #9
    Registered User
    Join Date
    07-19-2015
    Location
    NONE
    MS-Off Ver
    Excel
    Posts
    9

    Re: How to find Sum of # of days w/o counting overlapping days twice

    Thanks Dave.

    My apologies. I didn't update the references after copy pasting. I will cross check in detail and get back.

+ 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] Find days between days, but including the starting date.
    By Jocamo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-25-2015, 10:37 PM
  3. Calculating # of Overlapping days with several date ranges.
    By CarlSVM in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-06-2014, 07:09 AM
  4. Replies: 0
    Last Post: 07-30-2012, 04:51 PM
  5. Counting Continuous Days within overlapping Date Ranges
    By mgaworecki in forum Excel General
    Replies: 3
    Last Post: 09-07-2011, 08:33 AM
  6. Replies: 9
    Last Post: 09-03-2007, 08:26 PM
  7. Dividing a time span into shifts - overlapping days
    By Heidi in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 02-27-2006, 10:14 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