+ Reply to Thread
Results 1 to 13 of 13

Countif Multiple Criteria and Multiple Sheets

  1. #1
    Registered User
    Join Date
    04-27-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    8

    Countif Multiple Criteria and Multiple Sheets

    I currently have this forumula:

    =SUMPRODUCT(COUNTIF(A4, INDIRECT("'"&"Sheet5"&"'!A2:A35"))) + SUMPRODUCT(COUNTIF(INDIRECT("'"&"Sheet5"&"'!B2:B35"), "Active"))

    I am trying to have a count of all the statements that contains the value in A4 which is "EBAY" and have a status of "Active" from a list of 1000 statements. Currently this counts all the statements of Ebay and then adds on top all the Active a total of 170. I in fact want the value 8 which is the open ebay statements.

    So I need this to only count if both criteria are met. This is across multiple sheets hence the sumproduct.

    Any Ideas?

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Countif Multiple Criteria and Multiple Sheets

    Hi Kilipo,

    Welcome to the forum.

    Would you be able to upload the sample workbook.. I would like to apply a different solution. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    04-27-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Countif Multiple Criteria and Multiple Sheets

    Hi,

    Thanks here is the attached file, FYI I do not want any extra columns added.

    sample_1.xlsx

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Countif Multiple Criteria and Multiple Sheets

    Ok... see the attached file.. thanks
    sample_1.xlsx

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Countif Multiple Criteria and Multiple Sheets

    Given previous upload in .xlsx format we assume XL2007 or above thereby permitting use of COUNTIFS

    First post implies you're aggregating in 3D form:

    Please Login or Register  to view this content.
    where A1:A4 holds list of 4 sheet names to be aggregated in unison.

  6. #6
    Registered User
    Join Date
    04-27-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Countif Multiple Criteria and Multiple Sheets

    In Excel 2010 the {} seem to be removed and then the forumla does not work, for example the first column returns 1 instead of 2. Why would this be?

  7. #7
    Registered User
    Join Date
    04-27-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Countif Multiple Criteria and Multiple Sheets

    Quote Originally Posted by DonkeyOte View Post
    Given previous upload in .xlsx format we assume XL2007 or above thereby permitting use of COUNTIFS

    First post implies you're aggregating in 3D form:

    Please Login or Register  to view this content.
    where A1:A4 holds list of 4 sheet names to be aggregated in unison.
    I do not understand this bit?? I have 2 sheets "where A1:A4 holds list of 4 sheet names to be aggregated in unison".

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Countif Multiple Criteria and Multiple Sheets

    Your first post implied you're aggregating in 3D which is why you are using COUNTIF within SUMPRODUCT.

    Assume you have 2 data sheets titled "Sheet1" and "Sheet2" - both sheets are identical in layout containing names in Column A (A1:A10), status in Column B (B1:B10)

    Your intention on Sheet3 is to count how many people on Sheet1 & Sheet2 are both "Active" and called "David"

    In Sheet3 A1 we type: Sheet1
    In Sheet3 A2 we type: Sheet2
    In Sheet3 A3 we type: David
    In Sheet3 B3 we type: Active
    In Sheet3 C3 we enter following formula:

    Please Login or Register  to view this content.
    Hopefully that makes sense.

    If you're not aggregating in 3d (across multiple sheets simultaneously) then you do not need to use SUMPRODUCT.
    Last edited by DonkeyOte; 04-28-2012 at 06:54 AM. Reason: modified narrative

  9. #9
    Registered User
    Join Date
    04-27-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Countif Multiple Criteria and Multiple Sheets

    I was hoping to expand this:

    =SUMPRODUCT(COUNTIF(A2, INDIRECT("'"&"sheet 5"&"'!'Sheet 5'!C2:C12")))

    to include only count if b2:b12 is also "active"

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Countif Multiple Criteria and Multiple Sheets

    I am afraid the formula as you have above does not make sense - your INDIRECT will evaluate to:

    'Sheet 5'!'Sheet 5'!C2:C12

    If you are only evaluating a single sheet (ie Sheet 5) then you do not need to use SUMPRODUCT.

    I would suggest posting an example that accurately reflects your requirements.

    edit:

    I will be offline, however, others will assist.

  11. #11
    Registered User
    Join Date
    04-27-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Countif Multiple Criteria and Multiple Sheets

    The code is actually currently =SUMPRODUCT(COUNTIF(A2, INDIRECT("'"&"Sheet 5"&"'!C2:C12"))) this counts all the statements for a business, I only want it to count those statements which are are active.

    I hae attached the spreadsheet again which shows it more clearly. It is Excel 2010 which I am usuing.

    sample_1.xlsx

  12. #12
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Countif Multiple Criteria and Multiple Sheets

    Based on the sample file:

    Please Login or Register  to view this content.

  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Countif Multiple Criteria and Multiple Sheets


+ 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