WorksheetFunction.Count method (Excel)

Counts the number of cells that contain numbers and counts numbers within the list of arguments.

Syntax

expression.Count (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression A variable that represents a WorksheetFunction object.

Parameters

Name Required/Optional Data type Description
Arg1 - Arg30 Required Variant 1 to 30 arguments that can contain or refer to a variety of different types of data, but only numbers are counted.

Return value

Double

Remarks

Use Count to get the number of entries in a number field that is in a range or array of numbers.

Arguments that are numbers, dates, or text representation of numbers are counted.

Logical values and text representations of numbers that you type directly into the list of arguments are counted.

Arguments that are error values or text that cannot be translated into numbers are ignored.

If an argument is an array or reference, only numbers in that array or reference are counted. Empty cells, logical values, text, or error values in the array or reference are ignored.

If you want to count logical values, text, or error values, use the CountA function.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.