+ Reply to Thread
Results 1 to 10 of 10

Counting Dates that fall within a certain month

  1. #1
    Registered User
    Join Date
    06-19-2008
    Posts
    63

    Counting Dates that fall within a certain month

    Please open the xls. file I've attached to help understand me problem.

    I have items arriving on certain dates (the dates are listed in column N)

    In the cell to the right of each month, I want to have a formula that will count the dated cells in column N that fall under each month.

    i.e. In cell B5, next to January, I want to display the total number of cells that contain a date in January (ultimately giving me the number of items that arrive in January) the number would read '5' because there are 5 dates in January that are in the list.

    How can I accomplish this?
    Attached Files Attached Files
    Last edited by wnstar21; 01-23-2009 at 04:58 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try:

    =SUMPRODUCT(--(TEXT($N$7:$N$35,"mmmm")=A5))

    copied down

    adjust range to suit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    You can use this for Jan, then copy down for the rest of the months:

    =SUMPRODUCT(--(MONTH(N$7:N$35)=ROW(A1)))

    This will only look for the month, regardless of the year. In other words, it will count it if it is Jan-08 or Jan-09. Is that ok?

    Jason

  4. #4
    Registered User
    Join Date
    06-19-2008
    Posts
    63
    I will only be using it for 5-6 month periods, at the most. So the year won't matter. I will let you know if this works.

    Thank you

  5. #5
    Registered User
    Join Date
    06-19-2008
    Posts
    63
    It works!

    But can I ask someone to interpret this formula?

    What does the '--' mean after sumproduct?

    What does the formula have 'A1' in it for January, when January is in cell A5?

  6. #6
    Registered User
    Join Date
    06-19-2008
    Posts
    63
    I don't know why, but whem I change the range to the real range I will be using (in another Excel file). All of the months work, except for January.

    The range is from R72:R250. And January returns '171', which I can't figure out how

    So close, please help!

  7. #7
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Which formula are you using?

    Here is a good write-up of how Sumproduct works:

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    put year in a1
    then
    =SUMPRODUCT(($N$7:$N$35>=DATE($A$1,1,1))*($N$7:$N$35<=DATE($A$1,1,31)))
    will give total for jan of year in a1
    it gets a tad more complicate if you want to auto increment on drag, and then more fun if you want to span 2008-2009!

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by wnstar21 View Post
    It works!

    But can I ask someone to interpret this formula?

    What does the '--' mean after sumproduct?

    What does the formula have 'A1' in it for January, when January is in cell A5?

    If you have blank cells, the sumproduct formulas given will interpret them as have "January" because the blanks are treated as 0's and the 0 in date serial number translates to January 0, 1900...

    so you need to add another condition to prevent the blanks from being counted...

    try:

    Please Login or Register  to view this content.
    Where A5 contains the word January.... change as necessary and copy down.

  10. #10
    Registered User
    Join Date
    06-19-2008
    Posts
    63

    Re: Counting Dates that fall within a certain month

    The last formula works. Thank you very much!

    Also, the SUMPRODUCT article doesn't show up?

+ 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