+ Reply to Thread
Results 1 to 5 of 5

Count days per month within a period

  1. #1
    Forum Contributor
    Join Date
    06-24-2009
    Location
    Germany, MG
    MS-Off Ver
    Excel 2010
    Posts
    131

    Count days per month within a period

    Hello everyone,
    I have the following problem:

    I have a cell with a start date and a cell with an end date.
    Then I have some columns with many different months, eg. May 2010, June 2010 and so on. Is there a way, that Excel just counts the days of the respective months within the given period?

    What, if the start date is the same as the end date?

    Thanks a lot in advance and

    kind regards.
    Last edited by Cunner; 04-26-2010 at 08:57 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    21,528

    Re: Count days per month within a period

    A sample file would help in these instances but consider:

    Start dates in Column A - row 2 down
    End dates in Column B - row 2 down
    Header months in row 1 commencing from B (each Month is defined by 1st of month - eg 1-May-2010, 1-Jun-2010 etc...)

    C2: =IF(AND($B2>=C$1;$A2<=DATE(YEAR(C$1);MONTH(C$1)+1;0));1+MIN(DATE(YEAR(C$1);MONTH(C$1)+1;0);$B2)-MAX($A2;C$1);0)
    copied across results matrix

    Above assumes dates are inclusive - eg start 30-May end 31-May should result in 2 for May-10 column

  3. #3
    Forum Contributor
    Join Date
    06-24-2009
    Location
    Germany, MG
    MS-Off Ver
    Excel 2010
    Posts
    131

    Re: Count days per month within a period

    Thanks, it works and is great.
    I was wondering if there is an easier way to do this, but apparently it needs to be a "complicated" function like this.
    I do not really understand yet, what makes me use the date-function in some cases and and not some others. If someone could elaborate on this, please?

    Apart from that, my problem is solved, so thanks a lot DonkeyOte.

  4. #4
    Registered User
    Join Date
    02-02-2014
    Location
    dubai
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Count days per month within a period

    19-Feb-14 3-Mar-14
    can u show the same for this period. I'm unable to apply the formula and also can you please attach an excel sheet.

    Thanks in advance
    Vasu
    Last edited by vasu1988; 02-03-2014 at 05:44 AM.

  5. #5
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Count days per month within a period

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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