+ Reply to Thread
Results 1 to 5 of 5

Count based on rows and columns

  1. #1
    Registered User
    Join Date
    11-07-2007
    Posts
    38

    Count based on rows and columns

    I have a data table with two columns (surveillance #, date). I would like to count the number of times a particular surveillance # occured during a particular month, without doing a pivot table. In the attached example cell E2 i have the following equation

    =LOOKUP(2,1/(($D2=$A$2:$A$50)*(MONTH(E$1)=MONTH($B$2:$B$50))*(YEAR(E$1)=YEAR($B$2:$B$50))))

    which results in a value of 1, but not a count of the number of times surveillance #1 occurs in the month of January. Can someone point me in the right direction for how to make this return a count?

    Any help is appreciated.

    Thanks!
    Attached Files Attached Files

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

    Re: Count based on rows and columns

    Change formula to:

    =SUMPRODUCT(($D2=$A$2:$A$50)*(MONTH(E$1)=MONTH($B$2:$B$50))*(YEAR(E$1)=YEAR($B$2:$B$50)))
    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 Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: Count based on rows and columns

    Try this in E2 (and extend):

    =SUMPRODUCT(--(MONTH($B$2:$B$50)=MONTH(E$1));--($A$2:$A$50=$D2))

    (replace ; with , if needed)
    Never use Merged Cells in Excel

  4. #4
    Registered User
    Join Date
    11-07-2007
    Posts
    38

    Re: Count based on rows and columns

    Great!!! Thank you very much.

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

    Re: Count based on rows and columns

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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