+ Reply to Thread
Results 1 to 6 of 6

using countif function for multiple worksheets

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    using countif function for multiple worksheets

    I am trying to use countif to count the number of times a unique items occurs in multiple worksheets.

    For example, I want to count number of times "ITEM1" occurs in row 1 of sheets1, sheets2, sheets3, sheet4, etc. It may look like this:
    Sheet1 = 4 entries
    Sheet2 = 22 entries
    Sheet3 = 5 entries
    Sheet4 = 10 entries

    So the entire count would be 41 total. Thanks.
    Last edited by maacmaac; 01-28-2010 at 03:53 PM.

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

    Re: using countif function for multiple worksheets

    If your sheets are truly named in such a pattern as Sheet1, Sheet2, Sheet3, etc.. then try:

    =SUMPRODUCT(COUNTIF(INDIRECT("'Sheet"&ROW(INDIRECT("1:4"))&"'!A1:Z1"),"Item1"))

    where the 1:4 represents the sheet number range.. and A1:Z1 is the range in row 1 you want to count within

    or if your sheets are named without a numeric pattern...then list the sheet names in a column somewhere in your summary sheet and name that range "TabNames" without quotes.. then apply formula like:

    =SUMPRODUCT(COUNTIF(INDIRECT("'"&TabNames&"'!A1:Z1"),"Item1"))

    Where A1:Z1 is as above.
    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
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    Re: using countif function for multiple worksheets

    Thank you for your comments. Both methods work.

  4. #4
    Registered User
    Join Date
    01-28-2010
    Location
    Cold Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Lightbulb Re: using countif function for multiple worksheets

    How do you create the range?

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

    Re: using countif function for multiple worksheets

    You should really be starting your own thread on this.. but if you just mean how to create the TabNames..

    Then, enter the sheetnames in a vertical range of cells, select that range and go to Insert|Name|Define... enter TabNames in the Names in this workbook field.. the range in the Refers to field should be your selected range.

  6. #6
    Registered User
    Join Date
    01-28-2010
    Location
    Cold Canada
    MS-Off Ver
    Excel 2003
    Posts
    2

    Smile Re: using countif function for multiple worksheets

    Sorry about that. Thanks, I will next time.

+ 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