Excel Digest

  Excel help for the rest of us

24 Aug

How to count cells that contain numbers or dates

To count cells, within a given range or list of arguments, that contains only numbers you use the COUNT function.

  • Dates and text that represent numbers are considered numbers and will therefore be counted.
  • Logical values, text, or error values are not counted

Syntax

COUNT(value1,value2,…)

Examples:

COUNT(A1:A20) :counts numbers in a range of cells.
COUNT(A1:A20, 7) :counts numbers in a range of cells plus the second argument (7) which is counted as 1.

In the simple example depicted by the image below, cell B7 contains the function: =COUNT(B1:B6). The result is 4. as you can see the cells that contain the numbers 1, 2 and 17 and the cell that contains the date are counted. The the cells that contain the text “ABC” and “XYZ” are ignored.

Applies to: Excel 2003

Print This Post Print This Post

Related Posts

   
Summary of Excel count functions 
Count numbers greater than or less than a number 
How to count blank or empty cells in a range 

2 Responses to “How to count cells that contain numbers or dates”

  1. 1
    rose Says:

    hi…pls let me know how to find whether a particular cell contains digit….for Eg. rose1lotus…

  2. 2
    admin Says:

    Hi,

    I can’t think of a direct way to do this, but I have created a small user-defined function for this purpose. Please give it a try:

    Function IfHasDigit(Cell As Range)
    For i = 1 To Len(Cell.Value)
    If IsNumeric(Mid(Cell.Value, i, 1)) Then
    IfHasDigit = True
    Exit Function
    End If
    Next i
    IfHasDigit = False
    End Function

    Check this link for help on how to create a user defined function:

    http://www.exceldigest.com/myblog/2008/04/12/how-to-create-a-user-defined-function/

Leave a Reply

© 2008 Excel Digest | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo