+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    09-13-2007
    Posts
    56

    Count with 2 criteria

    I have 2 columns as attached file. I want to count how many Sales Rep. I and Sales Rep. II based on section criteria.

    For example, I can count manually that there're 3 Sales Rep. I in Sales HCM and 2 Sales Rep. II in Sales HCM. Or, there're 3 Sales Rep. I in Sales Central I

    Does anyone know how to use a function instead? Please advise
    Attached Files Attached Files

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

    Re: Count with 2 criteria

    This can be used:

    =SUMPRODUCT(--($B$2:$B$17="Sales Rep. I"),--($A$2:$A$17="Sales HCM"))

    If you would use Excel 2007 COUNTIFS() can also be used.

    =COUNTIFS(A2:A17,"Sales HCM",B2:B17,"Sales Rep. I")
    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

  3. #3
    Registered User
    Join Date
    09-13-2007
    Posts
    56

    Re: Count with 2 criteria

    It works. Many thanks

  4. #4
    Registered User
    Join Date
    09-13-2007
    Posts
    56

    Re: Count with 2 criteria

    In your formula there are two -- . What do they stand for? Pls advise

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

    Re: Count with 2 criteria

    Xl2003 and before did not have the COUNTIFS so one had to use the sumproduct. the --() produces a MASK with 0,1. These two are multiplied so the end result is an AND function.

    Example: A1:A3 have values 1,2,3
    sumproduct(--(A1:A3)>1,--(A1:A3)<3) = sumproduct(--(1,2,3)>1,--(1,2,3)<3) = sumproduct(--(False,True,True),--(True,True,False)) = sumproduct({0,1,1},{1,1,0}) = sumproduct(0,1,0) = 1
    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

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.2.0