Applies to: Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel for the web, Excel 2019, Excel 2016, Excel 2019 for Mac, Excel 2013, Excel 2010, Excel 2007, Excel 2016 for Mac, Excel for Mac 2011, Excel Starter 2010.
The COUNT function enables you to calculate the number of times some data appears in a spreadsheet.
COUNT(value1, [value2], …)
The COUNT function syntax contains these specific arguments:
- value1 – Essential. The first item, cell reference, or cell range amongst those which you want to count numbers.
- value2, … – Optional. A choice of up to 255 extra items, cell references, or ranges within the target range where you want to count numbers.
NB: The arguments can include or specify a range of various data types, although only numbers are counted.
- Arguments comprising numbers, dates, or a text form of numbers (for instance, a number covered in quotation marks, such as “1”) are counted.
- Logical values and text symbolisations of numbers that you enter directly into the list of arguments are counted.
- Arguments including error values or text which do not represent numbers are not counted.
- If an argument is an array or reference, only numbers contained in that array or cell reference are counted. Arguments which will not be counted include empty cells, logical values, text, or error values in the array or reference.
- Use the COUNTA function if you aim to count logical values, text, or error values.
- Use the COUNTIF function or the COUNTIFS function to only count numbers that meet pre-defined criteria.
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.
|=COUNT(A2:A7)||Counts the number of cells that contain numbers in cells A2 through A7.||3|
|=COUNT(A5:A7)||Counts the number of cells that contain numbers in cells A5 through A7.||2|
|=COUNT(A2:A7,2)||Counts the number of cells that contain numbers in cells A2 through A7, and the value 2||4|