+ Reply to Thread
Results 1 to 6 of 6

COUNTIF Function using more than one criterion

  1. #1
    Registered User
    Join Date
    07-19-2007
    Posts
    3

    COUNTIF Function using more than one criterion

    I have created the following table in excel

    Month/Yr Status
    May-07 1
    May-07 2
    May-07 1
    May-07 1
    Jun-07 2
    Jun-07 1
    Jun-07 1

    I now want to summarise this information in the following table

    Month/Yr No. of "1" No. of "2"
    May-07 x y
    Jun-07 v z

    I know that it is possible to count the number of cells which fulfil certain criteria by using the COUNTIF function. However I want to count the cells that have the entry "1" that are in May-07, then the cells that have the entry "1" that are in Jun-07. I currently have just used a COUNTIF function for each month (set the countif for each entry in the second table to look at specific cells), but I am trying to figure out how to just set one formula with two criteria (all cell in May that have the number "1") Of course the actual spreadsheet that I am using is much more complicated with hundreds of entries - this is just a simplified version of the problem.

    Any suggestions?

    Thanks!

  2. #2
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544
    Proposing date in col. A and nrs. 1, 2 in col. B :

    =SUMPRODUCT((A1:A10=Date)*(B1:B10=Nr.)*1)

    To learn more about this function look at my site.

    Erik
    Just keep it simple !


    http://www.excelguide.eu
    In English as well as in Dutch

  3. #3
    Registered User
    Join Date
    07-19-2007
    Posts
    3
    I am not quite sure what you mean by that formula.

    In the first table the dates and the numbers are in two separate columns, they got pushed out of alignment when I posted.

    Maybe I wasn't specific enough in asking my question.

    I want to a formula that will count the number of cells that contain the number "1" that are in may, then the number of cells that contain the number "1" that are in june and so on.

    -ary
    http://etesies.blogspot.com

  4. #4
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544
    The formula would be like this :

    =SUMPRODUCT((A1:A10="May-07")*(B1:B10=1)*1)

    Instead of "May-07" I recommend to include a cell here were you enter it.

    Erik

  5. #5
    Registered User
    Join Date
    07-19-2007
    Posts
    3
    Thanks a lot. That worked perfectly - I just divided the sum by 2 to get the number of "2". Sorry about not getting it first time round.

  6. #6
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544
    No problem at all David, glad I could help you along.

    Erik

+ 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