+ Reply to Thread
Results 1 to 13 of 13

Counting Values across multiple sheets

  1. #1
    Registered User
    Join Date
    03-12-2012
    Location
    Manchester, England
    MS-Off Ver
    MS 365
    Posts
    52

    Counting Values across multiple sheets

    Hi All
    I am trying to count the number of times the letter "P" appears in the same cell reference, C3, across a number of worksheets.
    The worksheets represent meeting dates and are named "Oct1", "Oct8", "Oct15", "Oct22", "Oct29", "Nov5" etc through to "Dec17".

    The formula I thought should work is =COUNTIF('Oct1:Dec17'!C3,"P") but that just returns a #VALUE! error.

    Anyone got any ideas about why it isn't working.

    Any help gratefully received.
    Many thanks.
    Chris

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Counting Values across multiple sheets

    countif() works only on a worksheet at a time. One could write a macro to browse the entire workbook and count the "p" apperances..

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Counting Values across multiple sheets

    You can't use 3-d references with COUNTIF.

    One possible solution is to put the COUNTIF formula in the same cell in every sheet - a quick way of doing this is to group all those sheets together (by selecting the first tab in the sequence, then holding down the SHIFT key, then clicking on the last tab in the sequence and releasing SHIFT) and then put this formula in, say, cell Z1:

    =COUNTIF(C3,"*P*")

    Then ungroup the sheets by right-clicking on a sheet tab and clicking Ungroup Sheets.

    Then in your summary sheet you can have a formula like:

    =SUM('Oct1:Dec17'!Z1)

    Hope this helps.

    Pete

  4. #4
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Counting Values across multiple sheets

    Try this:
    Please Login or Register  to view this content.
    The red one is a list name of sheet
    Click (*) if you received helpful response.

    Regards,
    David

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting Values across multiple sheets

    Here's another one:

    =SUMPRODUCT(COUNTIF(INDIRECT(TEXT(41548+{0,7,14,21,28,35,42,49,56,63,70,77},"mmmd")&"!C3"),"P"))

    We can shorten it a bit by using a defined name.

    Goto the Formulas tab>Define Name
    Name: Array
    Refers to: ={0,7,14,21,28,35,42,49,56,63,70,77}
    OK out

    Then the formula becomes:

    =SUMPRODUCT(COUNTIF(INDIRECT(TEXT(41548+Array,"mmmd")&"!C3"),"P"))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Counting Values across multiple sheets

    Trust you to think of that, Biff !!

    Nice one.

    Pete

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting Values across multiple sheets

    Thanks, Pete!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting Values across multiple sheets

    We can shorten it a bit more...

    Name: Sheets
    Refers to: =TEXT(41548+Array,"mmmd")

    Then the formula becomes:

    =SUMPRODUCT(COUNTIF(INDIRECT(Sheets&"!C3"),"P"))

  9. #9
    Registered User
    Join Date
    03-12-2012
    Location
    Manchester, England
    MS-Off Ver
    MS 365
    Posts
    52

    Re: Counting Values across multiple sheets

    Hi SDCh
    I tried the formula and it returned a #REF! error.
    The actual formula now reads =SUMPRODUCT(COUNTIF(INDIRECT("'"&DEC1:OCT17&"'!C3"),"P"))
    even though I put in the range &Oct1:Dec17& so there is something it doesn't like about the syntax.
    I have even tried naming the range and using that in the formula but that doesn't work either.
    Thanks
    Chris

  10. #10
    Registered User
    Join Date
    03-12-2012
    Location
    Manchester, England
    MS-Off Ver
    MS 365
    Posts
    52

    Re: Counting Values across multiple sheets

    Hi Tony
    thanks for your suggestion but you'll have to forgive my inexperience please and just give some pointers as to what certain things refer to in your formula, namely:
    1. 41548
    2. {0,7,14,21,28,35,42,49,56,63,70,77}
    3. mmmd


    Thanks for your understanding
    Chris

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Counting Values across multiple sheets

    Hi Chris,

    Tony won't be on-line for a few hours so I hope he doesn't mind if I answer for him:

    1. The number 41548 is the serial number that represents the date of 1st October 2013 (put that number in a cell somewhere and format the cell as a date).

    2. Those numbers (increments of 7) are added onto that start date to get other dates which are a week apart.

    3. The string "mmmd" is a format string used in conjunction with the TEXT command - it converts those dates into the format OCT1, or OCT7, or OCT14 etc. to match the names of your sheets.

    The formula takes each sheet name in turn and uses it within the COUNTIF function.

    Hope this helps.

    Pete

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Counting Values across multiple sheets

    Good explanation.

    Thanks, Pete!

  13. #13
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Counting Values across multiple sheets

    The red one is a list name of sheet
    What I mean is make a list name of the worksheet on one column,
    on my example my list sheet on column A2 to A4 ("Oct1", "Oct8", "Oct15")


    I think you must upload the example file (all sensitive data removed),
    so everyone in here can give you a solution base on your condition

+ 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. Counting with multiple criterias across multiple sheets
    By k.m. in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-11-2013, 03:40 PM
  2. [SOLVED] Counting multiple items with multiple criteria from multiple sheets?
    By essee in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-23-2013, 01:56 AM
  3. Counting from multiple sheets
    By jasond88 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-31-2013, 05:33 PM
  4. Counting Cells With Multiple Criteria on Multiple Sheets
    By ericmeiers in forum Excel General
    Replies: 5
    Last Post: 08-04-2012, 10:23 PM
  5. Counting Formula from Values on other sheets
    By nacho in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-01-2007, 01:07 PM

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