+ Reply to Thread
Results 1 to 4 of 4

count specific days within date range

  1. #1
    Registered User
    Join Date
    02-20-2011
    Location
    Dublin
    MS-Off Ver
    Excel 2007
    Posts
    88

    count specific days within date range

    Hi All,

    I have a date range like :

    A9 (start Date) = 12-01-2012
    A10 (end Date) = 08-03-2012


    And i need to divide this up into 2 groups Summer and Winter

    Summer runs from 01-MAR to 31-OCT each year
    Winter runs from 01-NOV to 28/29-FEB each year


    So with the example above i need it to divide the 57 total days up as

    8 days in summer
    49 days in winter

    I need this to work no matter what year - can anyone please suggest how i can go about this please ?

    Edit : This can be 2 individual formulas - i dont necessarily need them as one

    Thanks in advance

    Saz
    Last edited by Sazza; 03-27-2012 at 07:10 AM. Reason: update

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: count specific days within date range

    Summer

    =SUMPRODUCT((ROW(INDIRECT(A9&":"&A10))>=DATE(YEAR(A10),3,1))*(ROW(INDIRECT(A9&":"&A10))<DATE(YEAR(A10),11,1)))

    Winter

    =SUMPRODUCT(--(ROW(INDIRECT(A9&":"&A10))>1))-B9

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,704

    Re: count specific days within date range

    As your periods are entire months you could use a variation on Bob's approach to count dates in months, e.g. for Winter days

    =SUMPRODUCT((MONTH(ROW(INDIRECT(A9&":"&A10)))={1,2,11,12})+0)

    and then, of course all the other days are in the Summer so if you have that formula in A11 you can use this formula to get the total of the Summer days

    =A10-A9+1-A11

    This approach will work even if your date range is spread across several years
    Audere est facere

  4. #4
    Registered User
    Join Date
    02-20-2011
    Location
    Dublin
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: count specific days within date range

    Thanks a mill Bob & daddylonglegs - works perfectly - really appreciate your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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