Sei sulla pagina 1di 3

5/10/13

Count how often a value occurs - Excel - Office.com

Count how often a value occurs


Let's say you want to find out how many times particular text or a number value occurs. For example: If a range 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.
Show All

What do you want to do?


Count how often a single value occurs by using a function Count how often multiple number values occur by using functions Count how often multiple text or number values occur by using functions Count how often multiple values occur by using a PivotTable report

Count how often a single value occurs by using a function


Use the COUNTIF function to perform this task.

Example
The example may be easier to understand if you copy it to a blank worksheet. How to copy an example A 1 2 3 4 5 6 7 Salesperson Buchanan Buchanan Suyama Suyama Buchanan Dodsworth Formula =COUNTIF(A2:A7,"Buchanan") =COUNTIF(A2:A7,A4) =COUNTIF(B2:B7,"< 20000") =COUNTIF(B2:B7,">="&B5) B Invoice 15,000 9,000 8,000 20,000 5,000 22,500 Description (Result) Number of entries for Buchanan (3) Number of entries for Suyama (2) Number of invoice values less than 20,000 (4) Number of invoice values greater than or equal to 20,000 (2)

Function details
COUNTIF

Count how often multiple number values occur by using functions


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.

Example
The example may be easier to understand if you copy it to a blank worksheet. How to copy an example A 1 2 3 4
office.microsoft.com/en-001/excel-help/count-how-often-a-value-occurs-HP001127779.aspx 1/3

B Salesperson Buchanan Davolio

C Type Beverages Dairy

D Sales 3571 3338

Region South West

5/10/13

Count how often a value occurs - Excel - Office.com

5 6 7 8 9 10 11

East North South South South East North South Formula =COUNT(IF((A2:A11="South")* (C2:C11="Meat"),D2:D11)) =COUNT(IF((B2:B11="Suyama")* (D2:D11=>1000),D2:D11))

Suyama Suyama Dodsworth Davolio Davolio Suyama Davolio Dodsworth Description (result) Number of salespeople who sold meat in the South region (3) Number of sales greater than 1000 by Suyama (2)

Beverages Dairy Produce Meat Meat Produce Produce Meat

5122 6239 8677 450 7673 664 1500 6596

NOTES

The formulas in the example must be entered as array formulas. After copying the example to a blank worksheet, select the formula cell. Press F2, and then press CTRL+SHIFT+ENTER. If the formula is not entered as an array formula, the error #VALUE! is returned. For these formulas to work, the second argument to the IF function must be a number.

Function details
COUNT IF

Count how often multiple text or number values occur by using functions
Use the IF and SUM functions to do this task: Assign a value of 1 to each true condition by using the IF function. Add the total, by using the SUM function.

Example
The example may be easier to understand if you copy it to a blank worksheet. How to copy an example A 1 2 3 4 5 6 7 Salesperson Buchanan Buchanan Suyama Suyama Buchanan Dodsworth Formula =SUM(IF((A2:A7="Buchanan")+ (A2:A7="Dodsworth"),1,0)) =SUM(IF((B2:B7<9000)+(B2:B7>19000),1,0)) =SUM(IF(A2:A7="Buchanan",IF(B2:B7<9000,1,0))) B Invoice 15,000 9,000 8,000 20,000 5,000 22,500 Description (Result) Number of invoices for Buchanan or Dodsworth (4) Number of invoices with values less than 9000 or greater than 19000 (4) Number of invoices for Buchanan with a value less than 9,000. (1)

NOTE The formulas in this example must be entered as array formulas. Select each cell that contains a formula, press F2, and then press CTRL+SHIFT+ENTER.

Function details
office.microsoft.com/en-001/excel-help/count-how-often-a-value-occurs-HP001127779.aspx 2/3

5/10/13

Count how often a value occurs - Excel - Office.com

IF SUM

Count how often multiple values occur by using a PivotTable report


You can use a PivotTable report to display totals and to count the occurrences of unique values. 1. Select the column containing the data.

2. On the Data menu, click PivotTable and PivotChart Report . 3. Click Finish . 4. Drag the column label from PivotTable Field List to Drop Row Fields Here. 5. Drag the same column label from PivotTable Field List to Drop Data Items Here.
NOTE If your data contains numbers, the PivotTable report totals the entries instead of counting them. To change from the Sum summary function to the Count summary function, on the PivotTable toolbar, click Field

Settings

, and then in the Summarize by box, click Count .


Contact Us Submit Feedback Legal Trademarks Privacy and Cookies Accessibility
2013 Microsoft Corporation. All rights reserved.

Site Directory

office.microsoft.com/en-001/excel-help/count-how-often-a-value-occurs-HP001127779.aspx

3/3

Potrebbero piacerti anche