Excel COUNT Function

The Excel COUNT function returns the number of cells that contain numeric values in a specified range

Example: Excel COUNT Function

Excel COUNT Function

METHOD 1. Excel COUNT Function

EXCEL

=COUNT(C5:C13)
Result in cell C14 (5) - returns the number of cells that contain a numeric value from the selected range. In this example it would include cells C9 (15/03/2017), C10 (25), C11 ($100), C12 (-15) and C13 (15%).

=COUNT(D5:D13)
Result in cell D14 (4) - returns the number of cells that contain a numeric value from the selected range. In this example it would include cells D5 (51), D8 (17), D9 (27), and D10 (-40).

METHOD 2. Excel COUNT function using the Excel built-in function library

EXCEL

Formulas tab > Function Library group > More Functions > Statistical > COUNT > populate the input box

=COUNT(C5:C13)
Note: in this example we are populating an input box with a single range.
Built-in Excel COUNT Function

METHOD 1. Excel COUNT function using VBA

VBA

Sub Excel_COUNT_Function()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("COUNT")

'apply the Excel COUNT function
ws.Range("C14") = Application.WorksheetFunction.Count(ws.Range("C5:C13"))
ws.Range("D14") = Application.WorksheetFunction.Count(ws.Range("D5:D13"))

End Sub

OBJECTS
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
Range: The Range object is a representation of a single cell or a range of cells in a worksheet.
PREREQUISITES
Worksheet Name: Have a worksheet named COUNT.

ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell references ("C14") and ("D14") in the VBA code to any cell in the worksheet, that doesn't conflict with the formula.

Usage of the Excel COUNT function and formula syntax

EXPLANATION

DESCRIPTION
The Excel COUNT function returns the number of cells that contain numeric values in a specified range.
SYNTAX
=COUNT(value1, [value2], ...)
ARGUMENTS
value1: (Required) Any value, a cell reference or a range of cells.
value2: (Optional) Any value, a cell reference or a range of cells.

ADDITIONAL NOTES
Note 1: In Excel 2007 and later the COUNT function can accept up to 255 value arguments. In Excel 2003 the COUNT function can only accept up to 30 value arguments.
Note 2: Ignores empty cells an cells that contain text.
Note 3: Ignores TRUE and FALSE logical values.
Note 4: Includes both numbers and dates.