Inside The Web
    Facebook Twitter Instagram
    Inside The Web
    • Office
      • Excel
      • Ms Word
      • OneDrive
      • Google Docs
      • Google Sheets
      • Google Drive
    • Email
      • Gmail
      • Outlook
      • Emal Etiquette
    • Office Etiquette
    • Productivity
    Inside The Web
    Home»Office»Excel»How to Count Number of Occurrences in Excel

    How to Count Number of Occurrences in Excel

    Asmi DhakalBy Asmi DhakalDecember 27, 2023 Excel 4 Mins Read

    You may be looking to count the number of occurrences in Excel to analyze trends, patterns, and outliers in your data.

    Excel has several functions to assist you in counting occurrences within the spreadsheet. Among such functions, COUNTIF and COUNTIFS functions count occurrences based on specific conditions.

    Similarly, Excel has three dedicated functions such as COUNTBLANK, COUNTA, and COUNT to count blanks, non-blanks, and numbers, respectively.

    In this article, we will dive into all the ways you could count the number of occurrences in Excel.

    Count Occurrence of a Single Value

    Function UsedData TypeSyntax
    COUNTIFSTATISTICAL=COUTIF(range, criteria)

    Say, you’re analyzing the sales sheet of a company that distributes home appliances. Your manager asks you to list the total units sold for each product. How would you automate this task?

    Data table

    The answer is the COUNTIF function.

    Let’s use COUNTIF to count how many stoves this company sold in the month of July. Similarly, let’s also count the number of appliances that cost over $150.

    In cell G6, I entered the following formula to count the number of Stoves:

    =COUNTIF(B5:B20,"Stove")
    Count number of occurrences for text

    In cell G10, here’s the formula I entered to count the number of appliances that cost over $150.

    =COUNTIF(D5:D20,">150")
    Count number of occurrences for numbers

    Count Occurrence of Multiple Values with Different Criteria

    Function UsedData TypeSyntax
    COUNTIFSSTATISTICAL=COUNTIFS(criteria_range1,criteria1,...)

    When you have multiple criteria to make counts, using COUNTIF will be a bit difficult. Instead, use the COUNTIFS function to set multiple criteria for making your count.

    Let’s put this function to use. In this sheet, I have an attendance sheet for a workshop with 3 different sessions.

    data table in excel

    We’ve been assigned to count the number of employees with perfect attendance. Now, we need to consider all three sessions when making the attendance count.

    In cell F6, here’s the formula I used to make this count:

    =COUNTIFS(B5:B25,"Present",C5:C25,"Present",D5:D25,"Present")
    COUNTIFS function to count occurrence

    Use IF to Count Occurrence Based on Conditions

    Function UsedData TypeSyntax
    IFBOOLEAN=IF(logical_text,[value_if_true],[value_if_false])
    COUNTASTATISTICAL=COUNTIF(value1,[value2…])

    You can count occurrences based on conditions set using the COUNTA and IF functions.

    The COUNTA function in Excel is used to count non-blank cells. This includes text, numeric, alphanumeric, and even hidden characters. 

    If you’ve been using Excel for a while, you must already be familiar with the IF function. It returns TRUE or FALSE based on a set criteria. However, you can also customize the returned value if it’s true or false.

    We can nest the COUNTA function inside the IF function to count values based on criteria.

    Take a look at this spreadsheet

    Attendance sheet

    We need to count the days an employee was present in the 7-day workshop.

    Using the IF function, we will check if the value is equal to “Employed.” If the value is true, we will use COUNTA to count the non-blanks in the range C5:I5. Else, IF returns “N/A.”

    In cell J5, here’s the formula we entered and then applied to the entire range:

    =IF(B5="Employed",COUNTA(C5:I5),"N/A")
    IF and COUNTA functions

    Count Occurrence of Texts, Numbers, and Blanks

    Function UsedData TypeSyntax
    COUNTSTATISTICAL=COUNT(value1,[value2])
    COUNTASTATISTICAL=COUNTA(value1,[value2])
    COUNTBLANKSTATISTICAL=COUNTBLANK(range)

    Excel offers other functions including COUNT, COUNTA, and COUNTBLANK to count numbers, non-blank, and blank cells respectively.

    In this sheet, we have the total sales made by employees of a company. If the employee was not present or made no sales on the date of record, the Total sales field was left empty.

    Excel sheet

    As you can see some people are missing their employee ID. We’ve been assigned to count the following:

    • Total employee count
    • Employees with missing employee IDs
    • Employees who have made sales

    To count the total number of employees, we entered the following formula in cell E10:

    =COUNTA(B5:B76)
    COUNTA function Excel

    We counted the employees with missing IDs using this formula in cell F10:

    =COUNTBLANK(A5:A76)
    COUNTBLANK Excel

    To count the number of employees that made sales, here’s the formula we entered in cell G10:

    =COUNT(C5:C76)
    COUNT function Excel

    Count Occurrences Using PivotTable

    A PivotTable is an excellent tool to use when summarizing data. PivotTables are also useful in automating calculations such as summation and count.

    If you’ve stored your data as a table or range, you’ll first have to convert it into a PivotTable. Then, we’ll switch the data fields to count occurrences. 

    Excel usually identifies the operation you’re looking to perform. However, if the operation is not set to Count, you can manually change that.

    1. Select your data range.
      Select range
    2. Go to the Insert tab.
    3. From the Tables section, click PivotTable.
      Insert PivotTable Excel
    4. In the PivotTable from table or range window, select a destination and click OK.
      Insert PivotTable
    5. From the PivotTable Fields section, check the box next to the item you wish to count.
      PivotTable fields
    6. Drag and drop the same item under the Values section.
      Drag field to values pivottable
    7. If the operation is not set to count, click on the fly-out under the Values section > Value Field Settings.
      Value field settings
    8. Under Summarize value field by, choose Count > OK.
      Select operation for values pivottable
    9. This is how PivotTables counts your data.PivotTable to generate count
    Formula
    Asmi Dhakal

      Asmi is a content writer specializing in MS Office. She loves writing Excel-related content to assist other users to learn their way around the program. She started using Excel when she first entered the industry as a marketing intern. Soon, she realized that learning the often-overlooked spreadsheet program was no piece of cake. In her articles, she attempts to brief out complex topics to help beginner to intermediate-level Excel users. Asmi uses Excel for everything, including creating a grocery list to managing her personal finance. She’s a bit dramatic when it comes to the Flash Fill feature; so much so that could write a eulogy out of it. When she’s not working, you’ll find her learning a new recipe, or cleaning up her mess (out of the failed recipe).

      Related Posts

      Excel By Nisha Gurung

      How to Compare Two Columns in Excel Using VLOOKUP

      Excel By Nisha Gurung

      How to Share Excel Files with Multiple Users

      Excel By Nisha Gurung

      How to Filter Based on a List in Excel

      Add A Comment
      Table of ContentsToggle Table of ContentToggle
      • Count Occurrence of a Single Value
      • Count Occurrence of Multiple Values with Different Criteria
      • Use IF to Count Occurrence Based on Conditions
      • Count Occurrence of Texts, Numbers, and Blanks
      • Count Occurrences Using PivotTable
      • Home
      • About Us
      • Privacy Policy
      © 2025 Inside The Web

      Type above and press Enter to search. Press Esc to cancel.