+ Reply to Thread
Results 1 to 6 of 6

COUNTIF on dates

  1. #1
    Registered User
    Join Date
    11-30-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    7

    COUNTIF on dates

    Hi,

    I have two different worksheets.

    One has dates recorded as dd-mmm-yyyy (e.g., 28-Nov-2009).

    On the other, I have to create a lot (over 1000) of countifs against the months/years of these dates. So, for example, if there are several dates on the first workbook that fall in Nov-09, i want to do a countif on the second workbook that tells me how many Nov-09 dates there are.


    Since I have to create so many of these, however, I'd like to make the countif formula simple enough to copy and drag.

    Any ideas?
    Last edited by MartyB; 12-01-2009 at 07:53 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: COUNTIF on dates

    Hello MartyB

    If dates to count are in sheet1 A2:A1000 then you can do that like this:

    Put any date in the month to count in the other worksheet in A2 and then this formula in B2

    =SUMPRODUCT(--(TEXT(Sheet1!A$2:A$1000,"mmmyy")="TEXT(A2,"mmmyy")))

    copy down for other months

  3. #3
    Registered User
    Join Date
    11-30-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: COUNTIF on dates

    Hey,

    Thanks for the response, but unfortunately I didn't really understand what you wanted me to do in the second worksheet.

    I have attached example worksheets with some data to show what i want to do.

    Thanks again,
    Marty
    Attached Files Attached Files

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: COUNTIF on dates

    Hello Marty,

    There are several ways to do this. I changed the approach a little.....if you put dates in B1:M1 it's probably a little easier. I put in the first of each month and then formatted as mmm-yy......then I used this formula in B2 copied across

    =SUMPRODUCT(--(Sheet1!$B3:$B200-DAY(Sheet1!$B3:$B200)+1=B$1))

    see attached
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: COUNTIF on dates

    Sheet2!B1
    Please Login or Register  to view this content.
    Copy to the right till december

    Sheet2!B2
    Please Login or Register  to view this content.
    It is long as the data have empty cells in them !
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  6. #6
    Registered User
    Join Date
    11-30-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: COUNTIF on dates

    Unfortunately, these two solutions don't seem to be working for me when I copy them into the original worksheets. In reality, the sheets are in two different workbooks, but i'm replacing the "Sheet1" with the correct workbook title and sheet.

    Is there any way to do this without the SUMPRODUCT formula? It really seems too complex for what i wish to do. I simply want to do a change to text in the first sheet and then a simple countif on the second.

+ 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