+ Reply to Thread
Results 1 to 4 of 4

Counting String Instances across sheets

  1. #1
    Registered User
    Join Date
    10-15-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Counting String Instances across sheets

    In QR.xlsx, I have 5 sheets: Agrigate, Q1, Q2, Q3 and Q4.

    In Agrigate, I would like to sum the total occurrences of the string TREPAC from across the entire workbook.

    I have attempted =COUNTIFS('[QR.xlsx]Q1 13'!$A:$D, "TREPAC", '[QR.xlsx]Q2 13'!$A:$D, "TREPAC", '[QR.xlsx]Q3 13'!$A:$D, "TREPAC", '[QR.xlsx]Q4 13'!$A:$D, "TREPAC")
    which produced a value of 0.

    I also tried a similar thing that was =sum( =count(x), =count(x), ... ) but that was a total mess.

    Can anyone check my syntax on the above line?

    Anybody know of a better formula to use, or a better way to use the counifs formula?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Counting String Instances across sheets

    Wouldn't it simply be a sum of 4 COUNTIF() formulas?

    =SUM(COUNTIF('[QR.xlsx]Q1 13'!$A:$D, "TREPAC"), COUNTIF('[QR.xlsx]Q2 13'!$A:$D, "TREPAC"), COUNTIF('[QR.xlsx]Q3 13'!$A:$D, "TREPAC"), COUNTIF('[QR.xlsx]Q4 13'!$A:$D, "TREPAC"))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-15-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Counting String Instances across sheets

    ok, that worked, exactly as you typed it. thanks a lot.

    for edification, can you explain why countifs produced a value of 0?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Counting String Instances across sheets

    COUNTIFS() is an inclusive function, all of the tests within must be true for the count to go up. What you were trying to do was evaluate each sheet separately, a completely different idea.

    A good use of COUNTIFS would be to count how many rows in a single data table had:

    1) "Cat" in column A
    AND
    2) "Dog" in column B
    AND
    3) "Bird" in column C

    =COUNTIFS(A:A, "Cat", B:B, "Dog", C:C, "Bird")

    So, in this sample data, the answer would be ONE, because only row 3 has all 3 tests as true at the same time:

    Please Login or Register  to view this content.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] counting instances of a character within a string
    By mikelee101 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-15-2019, 05:28 AM
  2. Counting Instances of A String in Non-Contiguous Columns
    By robertmdvs in forum Excel General
    Replies: 6
    Last Post: 10-25-2011, 02:47 PM
  3. count number of instances of string in a string
    By lawrencef in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-28-2008, 02:06 AM
  4. Counting instances of a string in a column
    By jazzper in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-29-2008, 01:20 PM
  5. Replies: 0
    Last Post: 03-08-2007, 12:04 AM

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