Get instant live expert help with Excel or Google Sheets
“My Excelchat expert helped me in less than 20 minutes, saving me what would have been 5 hours of work!”

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
All articles COUNT Learn How to Count Occurrences in an Entire Workbook

Learn How to Count Occurrences in an Entire Workbook

We can count occurrences for the number of times a particular value (number, text, date, etc.) occurs across several worksheets in an excel workbook. We can do this by applying the COUNTIF, INDIRECT and SUMPRODUCT functions. We will walk through counting all occurrences in a workbook.

Figure 1: Number of Count Occurrences of the number 2 in the workbook

Naming the Worksheets

We will name the worksheets by doing the following:

  • We will rename the worksheet where we want to display our answer as PRIMARY SHEET by right-clicking on it and then, click on RENAME

Figure 2: Naming the Primary Sheet

  • We will create four new worksheets by clicking on the plus sign enclosed in a circle at the bottom of the worksheet

Figure 3: Creating Four Sheets

Setting up the Data

  • Our values will be inputted into SHEET1 to SHEET4
  • We will input the values as shown in figure 4 into Cell A4 to Cell A8 and name it VALUES with Cell A3

Figure 4: Inputting the Values

Naming the Range of Sheets

  • On the Primary sheet, we will input the names of the four worksheets (Sheet1, Sheet2, Sheet3, Sheet4) into Cell A4 to Cell A7
  • We will select the range (A4:A7)
  • After selecting the range, we will click on the drop-down arrow along the formula bar (fx) and name this range as Sheets

Figure 5: Naming the Range

Syntax to Count Occurrence in a Workbook

=SUMPRODUCT(COUNTIF(INDIRECT("'"&Sheets&"'!range"),count_value))

  • To count occurrences for this example, we will use the formula below:

=SUMPRODUCT(COUNTIF(INDIRECT("'"&Sheets&"'!A4:A8"),2))

Counting the Number of Occurrences of the Number 2

We will name Cell C3 on the PRIMARY SHEET as Count Value. We will then type or copy and paste the formula into Cell C4. After we have done this, we will press ENTER on the keyboard.

Formula: =SUMPRODUCT(COUNTIF(INDIRECT("'"&Sheets&"'!A4:A8"),2))

Figure 6: Counting Occurrences of the Number 2

Figure 7: Result of the Counted Occurrences of the Number 2

Explanation of the Formula

The INDIRECT function refers the ranges in the four sheets and the COUNTIF function counts the number of times the value in those ranges match the count value, which is 2. The SUMPRODUCT function then sums the returned count values from each sheet.    

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Solution examples
i have a table with Dates, First names , Last names and i want to count how many times a name occurs, but if a name occurs more than once on a particular date i need to only count it once. this is on excel and not google sheets
Solved by F. H. in 31 mins
I need a formula to count the number of rows that contain at least one of two possible phrases, but not give me the total number of instances that both phrases occur overall.
Solved by E. B. in 33 mins
i need to have whatever data i input in excelsheet file #1 column A automatically transfer to another worksheet/ another file#2 column B
Solved by I. H. in 20 mins
how do you make a cell automatically change colour based on the colour of other cells.ie i want to have a series of cells, perhaps 100, if any of these cells are red i want a seperate cell to be red, once all the red ones have changed colour the red cell can turn green??
Solved by V. C. in 60 mins
I have a sheet of 4 columns. Step1 - Column C has addresses and I want that column separately worked on: remove bad addresses and leave the good ones. Step2 - I want Column C (now with only the good addresses) brought back into the sheet and for all the "good addresses" cells to align back with the other cells that were on their individual rows.
Solved by T. C. in 60 mins

Leave a Comment

avatar

Subscribe to Excelchat.co

Get updates on helpful Excel topics

Subscribe to Excelchat.co

Did this post not answer your question?
Get a solution from connecting with the expert

Another blog reader asked this question today on Excelchat:

Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Our professional experts are available now. Your privacy is guaranteed.
Trusted by people who work at
Amazon.com, Inc
Facebook, Inc
Accenture PLC
Siemens AG
Macy's
The Allstate Corporation
United Parcel Service
Dell Inc