Count how often a value occurs (2024)

Skip to main content

Count how often a value occurs (1) Microsoft

Support

Sign in with Microsoft

Sign in or create an account.

Hello,

Select a different account.

You have multiple accounts

Choose the account you want to sign in with.

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 More...Less

Suppose you want to find out how many times particular text or a number value occurs in a range of cells. For example:

  • If a range, such as A2:D20, contains the number values 5, 6, 7, and 6, then the number 6 occurs two times.

  • If a column contains "Buchanan", "Dodsworth", "Dodsworth", and "Dodsworth", then "Dodsworth" occurs three times.

There are several ways to count how often a value occurs.

Use the COUNTIF function to count how many times a particular value appears in a range of cells.

Count how often a value occurs (2)

For more information, see COUNTIF function.

The COUNTIFS function is similar to the COUNTIF function with one important exception: COUNTIFS lets you apply criteria to cells across multiple ranges and counts the number of times all criteria are met. You can use up to 127 range/criteria pairs with COUNTIFS.

The syntax for COUNTIFS is:

COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2],…)

See the following example:

Count how often a value occurs (3)

To learn more about using this function to count with multiple ranges and criteria, see COUNTIFS function.

Let's say you need to determine how many salespeople sold a particular item in a certain region or you want to know how many sales over a certain value were made by a particular salesperson. You can use the IF and COUNT functions together; that is, you first use the IF function to test a condition and then, only if the result of the IF function is True, you use the COUNT function to count cells.

Notes:

  • The formulas in this example must be entered as array formulas.

    • If you have a current version of Microsoft 365, then you can simply enter the formula in the top-left-cell of the output range, then press ENTER to confirm the formula as a dynamic array formula.

    • If you have opened this workbook in Excel for Windows or Excel 2016 for Mac and newer versions, and want to change the formula or create a similar formula, press F2, and then press Ctrl+Shift+Enter to make the formula return the results you expect. In earlier versions of Excel for Mac, use Count how often a value occurs (4)+Shift+Enter.

  • For the example formulas to work, the second argument for the IF function must be a number.

Count how often a value occurs (5)

To learn more about these functions, see COUNT function and IF function.

In the examples that follow, we use the IF and SUM functions together. The IF function first tests the values in some cells and then, if the result of the test is True, SUM totals those values that pass the test.

Notes:The formulas in this example must be entered as array formulas.

  • If you have a current version of Microsoft 365, then you can simply enter the formula in the top-left-cell of the output range, then press ENTER to confirm the formula as a dynamic array formula.

  • If you have opened this workbook in Excel for Windows or Excel 2016 for Mac and newer versions, and want to change the formula or create a similar formula, press F2, and then press Ctrl+Shift+Enter to make the formula return the results you expect. In earlier versions of Excel for Mac, use Count how often a value occurs (6)+Shift+Enter.

Example 1

Count how often a value occurs (7)

The above function says if C2:C7 contains the values Buchanan and Dodsworth, then the SUM function should display the sum of records where the condition is met. The formula finds three records for Buchanan and one for Dodsworth in the given range, and displays 4.

Example 2

Count how often a value occurs (8)

The above function says if D2:D7 contains values lesser than $9000 or greater than $19,000, then SUM should display the sum of all those records where the condition is met. The formula finds two records D3 and D5 with values lesser than $9000, and then D4 and D6 with values greater than $19,000, and displays 4.

Example 3

Count how often a value occurs (9)

The above function says if D2:D7 has invoices for Buchanan for less than $9000, then SUM should display the sum of records where the condition is met. The formula finds that C6 meets the condition, and displays 1.

You can use a PivotTable to display totals and count the occurrences of unique values. A PivotTable is an interactive way to quickly summarize large amounts of data. You can use a PivotTable to expand and collapse levels of data to focus your results and to drill down to details from the summary data for areas that are of interest to you. In addition, you can move rows to columns or columns to rows ("pivoting") to see a count of how many times a value occurs in a PivotTable. Let's look at a sample scenario of a Sales spreadsheet, where you can count how many sales values are there for Golf and Tennis for specific quarters.

  1. Enter the following data in an Excel spreadsheet.

    Count how often a value occurs (10)
  2. Select A2:C8

  3. Click Insert > PivotTable.

  4. In the Create PivotTable dialog box, click Select a table or range, then click New Worksheet, and then click OK.

    An empty PivotTable is created in a new sheet.

  5. In the PivotTable Fields pane, do the following:

    1. Drag Sport to the Rows area.

    2. Drag Quarter to the Columns area.

    3. Drag Sales to the Values area.

    4. Repeat step c.

      The field name displays as SumofSales2 in both the PivotTable and the Values area.

      At this point, the PivotTable Fields pane looks like this:

      Count how often a value occurs (11)
    5. In the Values area, click the dropdown next to SumofSales2 and select Value Field Settings.

    6. In the Value Field Settings dialog box, do the following:

      1. In the Summarize value field by section, select Count.

      2. In the Custom Name field, modify the name to Count.

        Count how often a value occurs (12)
      3. Click OK.

    The PivotTable displays the count of records for Golf and Tennis in Quarter 3 and Quarter 4, along with the sales figures.

    Count how often a value occurs (13)

Need more help?

You can always ask an expert in the Excel Tech Communityor get support inCommunities.

See Also

Overview of formulas in Excel

How to avoid broken formulas

Find and correct errors in formulas

Excel keyboard shortcuts and function keys

Excel functions (alphabetical)

Excel functions (by category)

Need more help?

Want more options?

Discover Community

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Thank you for your feedback!

×

I'm an enthusiast with a deep understanding of Microsoft Excel and its various functions, formulas, and features. My expertise in this area comes from years of experience using Excel for data analysis, reporting, and complex calculations in both professional and personal contexts. I have also provided training and support to individuals and organizations seeking to maximize their productivity with Microsoft Excel.

Now, let's delve into the concepts used in the article you provided:

  1. COUNTIF Function: The article mentions using the COUNTIF function to count how many times a particular value appears in a range of cells. COUNTIF is a built-in Excel function that takes two arguments: a range of cells and a criteria. It counts the number of cells within the range that meet the specified criteria.

  2. COUNTIFS Function: The article introduces the COUNTIFS function, which is similar to COUNTIF but allows you to apply multiple criteria to cells across different ranges. COUNTIFS is particularly useful when you need to count occurrences based on multiple conditions.

  3. IF Function: The article discusses using the IF function in combination with the COUNT function to count cells based on a condition. The IF function is used to test a condition and returns one value if the condition is true and another if it's false.

  4. SUM Function: The SUM function is mentioned in conjunction with the IF function. It's used to add up values in a range of cells. In the examples provided, SUM is used to calculate the total of records that meet specific conditions.

  5. Dynamic Array Formulas: The article notes that some of the formulas must be entered as array formulas. Dynamic array formulas allow you to perform calculations on multiple cells and return multiple results. This functionality is available in newer versions of Excel.

  6. PivotTable: The article discusses using a PivotTable to display totals and count the occurrences of unique values. A PivotTable is a powerful tool in Excel for summarizing and analyzing data. It allows you to create customized reports by dragging and dropping fields to organize data in rows and columns, perform calculations, and count occurrences.

These concepts are essential for anyone working with Excel to efficiently manage and analyze data. If you have any specific questions or need further clarification on any of these concepts or how to use them in Excel, feel free to ask!

Count how often a value occurs (2024)

FAQs

How to count how often a value occurs in Excel? ›

Count how often a single value occurs by using the COUNTIF function. Use the COUNTIF function to count how many times a particular value appears in a range of cells.

How to calculate frequency in Excel using countif? ›

The COUNTIFS function applies criteria to cells across multiple ranges and counts the number of times all criteria are met. The syntax is as follows: =COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...) We need to specify criteria_range and criteria pair for each condition.

How do you count occurrences of unique values in Excel? ›

Count the number of unique values by using the FREQUENCY function. The FREQUENCY function ignores text and zero values. For the first occurrence of a specific value, this function returns a number equal to the number of occurrences of that value.

How to count how many times a value appears in a column Google Sheets? ›

Then, in the adjacent cell, enter the formula as =COUNTIF(A2:A16, C2) and click enter to get the first value. Then drag down using the auto fill handle. Empty Cell > Formula > Enter > Drag. This is how you can count the number of occurrences in a column in a Google Sheet.

How to count how many times a value appears in a column in pandas? ›

The simplest way to count the occurrences of values in a Pandas DataFrame or Series is to use the value_counts() method. This method returns a Series containing the counts of unique values in the input data. In this example, we created a DataFrame with three columns ( A , B , and C ) and six rows.

How do you use frequency function? ›

Here's how to use the FREQUENCY function in Excel:
  1. Enter raw data. Enter your raw data into a row, column or combination or rows and columns. ...
  2. Specify intervals. In a separate column, specify the intervals you want the FREQUENCY function to consider. ...
  3. Create an "Upper Limit" column. ...
  4. Create a "Frequency" column.
Feb 2, 2023

What is Countifs for frequency distribution? ›

The COUNTIFS function is like the COUNTIF function, which we used for making a Frequency Distribution Table for discrete data. However, the COUNTIF function counts values that match only one criteria, whereas the COUNTIFS function counts values based on two or more criteria.

How to find the frequency formula? ›

The frequency formula in terms of time is given as: f = 1/T where, f is the frequency in hertz, and T is the time to complete one cycle in seconds. The frequency formula in terms of wavelength and wave speed is given as, f = 𝜈/λ where, 𝜈 is the wave speed, and λ is the wavelength of the wave.

What is the frequency function in Excel? ›

The FREQUENCY function calculates how often values occur within a range of values, and then returns a vertical array of numbers. For example, use FREQUENCY to count the number of test scores that fall within ranges of scores. Because FREQUENCY returns an array, it must be entered as an array formula.

How do you count occurrences of a specific character in Excel? ›

To count certain, specific characters within cells

In the cell, enter =LEN(A4)-LEN(SUBSTITUTE(A4,"z","")) and press Enter.

How to count unique values in sheet? ›

The syntax is simple: =COUNTUNIQUE(range), where “range” refers to the cell range containing the values to count. This function efficiently identifies and counts distinct occurrences, providing quick insights into a dataset.

How do you count how many times text appears in a column? ›

In the empty cell, you can input the formula to count cells with text. The Excel formula for this function is "=COUNTIF (range, criteria)" without quotation marks. In this formula, the range is the cells you want to include in your count and the criteria is text.

What is the Countif function? ›

Use COUNTIF, one of the statistical functions, to count the number of cells that meet a criterion; for example, to count the number of times a particular city appears in a customer list. In its simplest form, COUNTIF says: =COUNTIF(Where do you want to look?, What do you want to look for?)

How do I count the most repeated values in Excel? ›

There are two functions in Excel that you can use to get the most frequent number(s) from a list of numbers. The first is MODE, and the second is MODE. MULT. The first function helps you to get the single most frequent number, and the second helps you to get multiple.

What is the Sumif function in Excel? ›

The SUMIFS function is a premade function in Excel, which calculates the sum of a range based on one or more true or false condition. It is typed =SUMIFS : =SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2] ...)

How to make a tally in Excel? ›

How to tally in Excel using a tally graph
  1. Input your data. First, input your data using either the range format or a table format. ...
  2. Add a 5-Mark column. ...
  3. Add a 1-Mark column. ...
  4. Create a bar chart. ...
  5. Flip the Y-Axis. ...
  6. Delete unneeded visual elements and reposition the graph. ...
  7. Set up your tally symbols. ...
  8. Fill with tally marks.
Sep 27, 2023

How to use sumif function in Excel? ›

If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John."

Top Articles
Latest Posts
Article information

Author: Saturnina Altenwerth DVM

Last Updated:

Views: 6216

Rating: 4.3 / 5 (64 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Saturnina Altenwerth DVM

Birthday: 1992-08-21

Address: Apt. 237 662 Haag Mills, East Verenaport, MO 57071-5493

Phone: +331850833384

Job: District Real-Estate Architect

Hobby: Skateboarding, Taxidermy, Air sports, Painting, Knife making, Letterboxing, Inline skating

Introduction: My name is Saturnina Altenwerth DVM, I am a witty, perfect, combative, beautiful, determined, fancy, determined person who loves writing and wants to share my knowledge and understanding with you.