+ Reply to Thread
Results 1 to 7 of 7

Calculate number of dates within a column based on Month

  1. #1
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Calculate number of dates within a column based on Month

    Hi,

    I have a column say column B for example that has a list of dates in the format dd/mm/yyyy. I would like a summary at the top of the columns to state how many dates there are for the current month. But I wondered if this was possible based on the TODAY() function or similar. Thus the user would not have to change anything.

    So for example at the start of the month it may state 14. Half way through the month down to 6 and at the end of the month 0 for example.

    Also is this possible with the month ahead based on the same principle?

    Thanks.
    Last edited by jpruffle; 05-15-2009 at 12:40 PM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Calculate number of dates within a column based on Month

    try this:

    =SUMPRODUCT(--(A1:A33>TODAY());--(A1:A33<DATE(YEAR(TODAY());1+MONTH(TODAY());1)))

    If you need to calulcate curent date too put >= in first formula.
    Also change ; to , if needed and extend range

  3. #3
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Calculate number of dates within a column based on Month

    That's great.

    What about for the month after?

    Also can you help me with the formula to calculate the total number of dates (events) within the month as a total?

    Thanks again for your help.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Calculate number of dates within a column based on Month

    For one more month change nukber from 1 to 2
    =SUMPRODUCT(--(A1:A33>TODAY());--(A1:A33<DATE(YEAR(TODAY());2+MONTH(TODAY());1)))


    If you need more than that you could consider of adding one more cell (E.g. C1) where you would write some date (e.g. 14/7/2009) or create drop down list with first dates of months. Then you can use:

    =SUMPRODUCT(--(A1:A33>TODAY());--(A1:A33<C1))

    And for current month

    =SUMPRODUCT(--(A1:A33>DATE(YEAR(TODAY());MONTH(TODAY());0));--(A1:A33<DATE(YEAR(TODAY());1+MONTH(TODAY());1)))

  5. #5
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Calculate number of dates within a column based on Month

    Thanks again for the reply.

    The formula:

    Please Login or Register  to view this content.
    Also adds dates that are greater than today? Can it just add dates starting from the 1st of the next month?

    Thanks

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Calculate number of dates within a column based on Month

    (A1:A33>DATE(YEAR(TODAY());1+MONTH(TODAY());0));

    Formula is the same in all cases.. You only need to adjust months.

    So MONTH(TODAY()) will give you current month (5).
    If you need montrh or two after just add +1 or +2
    or -1 for previous (X-1 is same as -1+X)

    Year (TODAY()) just give you current year but you can write 2009 instead
    Last edited by zbor; 05-15-2009 at 08:47 AM.

  7. #7
    Forum Contributor
    Join Date
    06-03-2008
    MS-Off Ver
    Excel 2007 (also have access to Excel 2000/2003)
    Posts
    368

    Re: Calculate number of dates within a column based on Month

    Thank you zbor,

    You've been a great help, once again.

+ 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