Count how often a value occurs (2024)

Skip to main content

Microsoft

Support

Support

Sign in

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 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 newer versions of Excel for Windows or Excel for Mac andwant 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.

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

Count how often a value occurs (4)

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 newer versions of Excel for Windows or Excelfor Mac 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.

Example 1

Count how often a value occurs (5)

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 (6)

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 (7)

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 (8)
  2. Select A2:C8

  3. SelectInsert > PivotTable.

  4. In the Create PivotTable dialog box, selectSelect a table or range, then selectNew Worksheet, and then selectOK.

    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 (9)
    5. In the Values area, select 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 (10)
      3. SelectOK.

    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 (11)

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.

Count how often a value occurs (12)

Microsoft 365 subscription benefits

Count how often a value occurs (13)

Microsoft 365 training

Count how often a value occurs (14)

Microsoft security

Count how often a value occurs (15)

Accessibility center

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

Count how often a value occurs (16)

Ask the Microsoft Community

Count how often a value occurs (17)

Microsoft Tech Community

Thank you for your feedback!

×

Count how often a value occurs (2024)
Top Articles
Reform of the German Investment Tax Act: Federal Ministry of Finance publishes 1st draft of the circular
tax 2022 kaufen & herunterladen
Devotion Showtimes Near Xscape Theatres Blankenbaker 16
Bank Of America Financial Center Irvington Photos
Fat Hog Prices Today
1970 Chevrolet Chevelle SS - Skyway Classics
Txtvrfy Sheridan Wy
The Pope's Exorcist Showtimes Near Cinemark Hollywood Movies 20
Phenix Food Locker Weekly Ad
Mustangps.instructure
Here's how eating according to your blood type could help you keep healthy
Music Archives | Hotel Grand Bach - Hotel GrandBach
13 The Musical Common Sense Media
Builders Best Do It Center
Studentvue Columbia Heights
Nj State Police Private Detective Unit
How to find cash from balance sheet?
How To Cut Eelgrass Grounded
Grab this ice cream maker while it's discounted in Walmart's sale | Digital Trends
London Ups Store
Christina Steele And Nathaniel Hadley Novel
Busted Newspaper Fauquier County Va
Popular Chinese Restaurant in Rome Closing After 37 Years
Sef2 Lewis Structure
Gazette Obituary Colorado Springs
The Many Faces of the Craigslist Killer
Rogue Lineage Uber Titles
Colonial Executive Park - CRE Consultants
Elite Dangerous How To Scan Nav Beacon
Effingham Daily News Police Report
Pokemon Inflamed Red Cheats
Christmas Days Away
Wells Fargo Bank Florida Locations
134 Paige St. Owego Ny
Rvtrader Com Florida
Solve 100000div3= | Microsoft Math Solver
Lucky Larry's Latina's
Craigslist Com Humboldt
Poe Flameblast
Lake Andes Buy Sell Trade
Craigslist en Santa Cruz, California: Tu Guía Definitiva para Comprar, Vender e Intercambiar - First Republic Craigslist
Wordle Feb 27 Mashable
Cabarrus County School Calendar 2024
Chr Pop Pulse
Cvs Coit And Alpha
Crigslist Tucson
Myra's Floral Princeton Wv
All Buttons In Blox Fruits
Bismarck Mandan Mugshots
Razor Edge Gotti Pitbull Price
How to Choose Where to Study Abroad
Latest Posts
Article information

Author: Patricia Veum II

Last Updated:

Views: 5950

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.