-
Select the cell where you want the result to appear.
-
On the Formulas tab, click More Functions, point to Statistical, and then click one of the following functions:
-
COUNTA: To count cells that are not empty
-
COUNT: To count cells that contain numbers.
-
COUNTBLANK: To count cells that are blank.
-
COUNTIF: To count cells that meets a specified criteria.
Tip: To enter more than one criterion, use the COUNTIFS function instead.
-
-
Select the range of cells that you want, and then press RETURN.
-
Select the cell where you want the result to appear.
-
On the Formulas tab, click Insert, point to Statistical, and then click one of the following functions:
-
COUNTA: To count cells that are not empty
-
COUNT: To count cells that contain numbers.
-
COUNTBLANK: To count cells that are blank.
-
COUNTIF: To count cells that meets a specified criteria.
Tip: To enter more than one criterion, use the COUNTIFS function instead.
-
-
Select the range of cells that you want, and then press RETURN.
How to get the row or column number of the current cell or any other cell in Excel.
This tutorial covers important functions that allow you to do everything from alternate row and column shading to incrementing values at specified intervals and much more.
We will use the ROW and COLUMN function for this. Here is an example of the output from these functions.
Though this doesn’t look like much, these functions allow for the creation of powerful formulas when combined with other functions. Now, let’s look at how to create them.
Get a Cell’s Row Number
Syntax
This function returns the number of the row that a particular cell is in.
If you leave the function empty, it will return the row number for the current cell in which this function has been placed.
If you put a cell reference within this function, it will return the row number for that cell reference.
This example would return 1 since cell A1 is in row 1. If it was =ROW(C24) the function would return the number 24 because cell C24 is in row 24.
Examples
Now that you know how this function works, it may seem rather useless. Here are links to two examples where this function is key.
Increment a Value Every X Number of Rows in Excel
Shade Every Other Row in Excel Quickly
Get a Cell’s Column Number
Syntax
This function returns the number of the column that a particular cell is in. It counts from left to right, where A is 1 and B is 2 and so on.
If you leave the function empty, it will return the column number for the current cell in which this function has been placed.
If you put a cell reference within this function, it will return the column number for that cell reference.
This example would return 1 since cell A1 is in row 1. If it was =COLUMN (C24) the function would return the number 3 because cell C24 is in column number 3.
Examples
The COLUMN function works just like the ROW function does except that it works on columns, going left to right, whereas the ROW function works on rows, going up and down.
As such, almost every example where ROW is used could be converted to use COLUMN based on your needs.
Notes
The ROW and COLUMN functions are building blocks in that they help you create more complex formulas in Excel. Alone, these functions are pretty much worthless, but, if you can memorize them and keep them for later, you will start to find more and more uses for them when working in large data sets. The examples provided above in the ROW section cover only two of many different ways you can use these functions to create more powerful and helpful spreadsheets.
Similar Content on TeachExcel
Sum Values from Every X Number of Rows in Excel
Tutorial: Add values from every x number of rows in Excel. For instance, add together every other va…
Formulas to Remove First or Last Character from a Cell in Excel
Tutorial: Formulas that allow you to quickly and easily remove the first or last character from a ce…
Formula to Delete the First or Last Word from a Cell in Excel
Tutorial:
Excel formula to delete the first or last word from a cell.
You can copy and paste the fo…
Reverse the Contents of a Cell in Excel — UDF
Macro: Reverse cell contents with this free Excel UDF (user defined function). This will mir…
Excel Function to Remove All Text OR All Numbers from a Cell
Tutorial: How to create and use a function that removes all text or all numbers from a cell, whichev…
Get the First Word from a Cell in Excel
Tutorial: How to use a formula to get the first word from a cell in Excel. This works for a single c…
Subscribe for Weekly Tutorials
BONUS: subscribe now to download our Top Tutorials Ebook!
For getting the count of numbers, dates, text, empty or non-blank cells, you may use various built-in functions in Excel.
Depending on the requirement, you may choose which one to use; for example, if you require the count of cells that contain numbers only, you may use the Excel COUNT function.
To get the count of all cells with numbers, text, dates etc except the blank cells, use the COUNTA function.
Similarly, for returning the count of cells based on certain criteria e.g. count of cells that contain “A” can be done by COUNTIF function and for multiple criteria use the COUNTIFS function. For example, return the count of cells that are between two dates.
To get the count of blank or empty cells, use the COUNTBLANK function.
In the following section, I will show you Count Formulas in Excel with data in spreadsheets. You may copy any formula in your sheet to see how it works.
-
1.
Get the count of numeric cells by COUNT function -
2.
What if cells also contain dates? -
3.
Using multiple ranges in COUNT function -
4.
Using Excel COUNTIF function for conditional counting -
5.
Getting the count of matched text -
6.
Using the ‘*’ wildcard in COUNTIF function -
7.
Using “>=” in COUNTIF for number count -
8.
Using “<” operator in COUNTIF function -
9.
An example of Not equal to operator “<>” -
10.
Getting count of multiple ranges by COUNTIF -
11.
The Example of using COUNTIF with dates -
12.
An example of COUNTA function -
13.
How to get the count of empty cells? -
14.
How to use COUNTIFS function -
15.
The example of using Excel COUNTIFS function -
16.
Using three conditions in COUNTIFS
Get the count of numeric cells by COUNT function
Let us start with a simple example of counting the number of cells that contain numbers only. For that, I have filled cells from A2 to A10 by numbers, text, and blank cells. See what we get by COUNT function:
The COUNT formula:
=COUNT(A2:A10)
You can see, the COUNT function only returned the count for cells containing numbers. The blank and text cells are ignored while numbers with currency format are also included.
What if cells also contain dates?
The COUNT function also reruns the cells that contain dates. To demonstrate that, I extended the above range to B10 cell and added two numbers and two dates in B cells. So, the COUNT formula is:
=COUNT(A2:B10)
See the sheet figure with formula and result:
Using multiple ranges in COUNT function
Two things are further used in this formula. The first is using multiple ranges i.e. A2:A10 and C4:C8. The second thing tested whether COUNT function returns the text with number e.g. “6test”. See the formula and output:
=COUNT(A2:A10,C4:C10)
You saw, the COUNT did not return “2test” occurrence.
You may provide up to 255 ranges, cell references or items that you want to get the count.
Using Excel COUNTIF function for conditional counting
If you require getting the count of the number of cells based on single criteria then use the COUNTIF function. If you separate two words: “COUNT” “IF”, it makes the purpose clear.
For example, COUNT the cells from A2:D1000 IF that contains the word “Microsoft”. Similarly, return the number of cells which date is less than or equal to 10/10/2010 and so on.
General Syntax of COUNTIF:
=COUNTIF(Where to search, What to search)
You may provide a range of cells, array, names range etc as the first argument.
In “What to search” argument, you will specify e.g.
- “London”
- A cell reference like A10
- “>1” count the cells which value is greater than 1
- “<=10” less than or equal to 10
The next section shows a few examples of using the Excel COUNTIF function.
Getting the count of matched text
In this example, we will get the count of “Apple” in our example sheet. The column A cells contain the Fruits and Vegetable names. In the COUNTIF function, I specified the Apple as follows:
The result:
You can see the text Apple occurred three times in the given range.
Using the ‘*’ wildcard in COUNTIF function
You may also use the wildcards (* and ?) in the COUNTIF function. The ‘*’ is used for any sequence of characters while ‘?’ mark for the single character.
In the following example, I used the “to*” in the COUNTIF for the same sheet as used in above example and see the formula and result:
The COUNTIF formula:
The result:
You saw the occurrences of Tomato (twice) and Potato (once) is returned as 3.
Using “>=” in COUNTIF for number count
For this example, I will use the single criteria for counting the cells containing the number of sales greater than or equal to 100 in the COUNTIF function.
For this example, the Excel sheet contains month names in B cells and number of sales in C cells. Following COUNTIF formula is used:
The resultant sheet:
If you count the number of sales greater than or equal to 100, it is 6 that COUNTIF returned.
Using “<” operator in COUNTIF function
Now, we will get the count of Number of Sales less than 100 by using COUNTIF function. The following formula is used:
The count is again 6.
An example of Not equal to operator “<>”
For this example, I used the Not Equal to operator which is “<>”. The criterion set in the COUNTIF is to return the number of sales not equal to 150 i.e.
Result:
If you look at the data in the Excel sheet, it contains 150 twice. So, the COUNTIF omitted these and returned 10 counts.
Getting count of multiple ranges by COUNTIF
In this example, we will get the count of two different ranges by using COUNTIF function twice and adding the returned result.
For that, I have added another column in above sheet i.e. Amount. By using the COUNTIF function, we will get the count of (number of sales more than 100) + (Sale amount greater than or equal to $15000). See how this is translated into COUNTIF:
=COUNTIF(C2:C13,«>100»)+COUNTIF(D2:D13,«>=15000»)
The returned result:
If you count the C cells (C2:C13) then the count of cells with more than 100 sales is 6. Add this to the count of D2:D15 cells with the amount greater or equal to 15000 then it is 7. The sum of both returned values is 13.
Note: Please do not mix it with using multiple conditions. The COUNTIF returned results separately and its result is summed. If we used minus operator then result would have been -1 i.e.
=COUNTIF(C2:C13,«>100») — COUNTIF(D2:D13,«>=15000»)
You may use more than two COUNTIF formulas as well. The function of using multiple conditions/criteria is COUNTIFS that is coming up in next sections.
The Example of using COUNTIF with dates
Just like the numbers, you may also write a criterion for date columns to get the count. For example, get the count of employees who joined after 3rd Jan 2012.
To demonstrate the usage of dates in COUNTIF function, I am using an Excel sheet containing fictitious records of employee names and their joining date. A named range is created which is referred to the COUNTIF function.
By using COUNTIF function, we will get the total count of employees, number of employees joined after 2010, the number of employees joined before 2007 and employees joined between 2008 to 2012. First, have a look at the resultant sheet which is followed by COUNTIF formulas:
The formula to get the total number of employees:
=COUNT(empData)
Where empData is the range name containing cells A3 to B7.
The COUNTIF formula for getting the number of employees joined after 2009:
=COUNTIF(empData, «>» & «2009-12-31»)
Joined on or before 2007:
=COUNTIF(empData, «<=» & «2007-12-31»)
Joined between 2008 to 2012 formula:
=COUNTIFS(empData,«>=»&«2007-01-01»,empData,«<=»&«2012-12-31»)
The last formula used COUNTIFS as we have two conditions to check. I will explain this in the COUNTIFS section.
You may learn more about the COUNTIF function in its tutorial: Using COUNTIF function.
An example of COUNTA function
If you require counting cells containing any type of data including numbers, text, empty string e.g. “”, dates, cells with error codes etc. then use the COUNTA function.
The COUNTA function will only omit the empty cells. See the following example, where I have used different types of values in Excel sheet and used COUNTA function for getting the count:
The COUNTA formula:
=COUNTA(B2:B10)
You can see, the resultant sheet displayed count as 7 as two cells in the given range are empty.
How to get the count of empty cells?
If you require the count of empty cells only then use the COUNTBLANK function. Have a look at the same Excel sheet and data as used for COUNTA function for demonstrating the COUNTBLANK function.
The Excel COUNTBLANK formula:
=COUNTBLANK(B2:B10)
The returned count is 2 as you can see the given range contains two blank cells.
How to use COUNTIFS function
As mentioned earlier, if you have multiple criteria to check for getting the count in a range, array etc. you may use the COUNTIFS function.
For example, return the count of those employees who joined after 10/20/2012 and their salary is $5000 or above. We have seen, the COUNTIF enables using single criterion only whereas COUNTIFS allows us getting the count based on above two criteria.
The example of using Excel COUNTIFS function
For the example of COUNTIFS function, I am using the same Excel sheet as used in an above example that contains Months, Number of Sales and Amount columns.
The requirement is to count those rows which Number of Sales is greater than or equal to 110 and amount >= $15000. The COUNTIFS formula is:
=COUNTIFS(C2:C13,«>=110»,D2:D13,«>=15000»)
The result:
You can see, the highlighted rows met both criteria. If you look at the first row, the amount is $15000 that is true, however, the Number of sales is 105 which is False; so COUNTIFS did not include this row.
Using three conditions in COUNTIFS
You may use up to 127 range/criteria pairs in the COUNTIFS function. In this example, I am using three conditions in the COUNTIFS. For that, extending the above formula and another criterion is added to return the count of those rows that start with month “J”. While the number of sales is set as greater than 100.
The COUNTIFS formula:
=COUNTIFS(B2:B13,«J*»,C2:C13,«>100»,D2:D13,«>=15000»)
The result:
You see, I used ‘*’ wildcard as the first criteria i.e. B2:B13,”J*”. If you go through the table, only two highlighted rows met all the criteria given in COUNTIFS function.
What Is COUNT In Excel?
The COUNT function in Excel counts the number of cells containing numerical values within the given range. It always returns an integer value.
The COUNT in Excel is an inbuilt statistical function, so we can insert the formula from the “Function Library” or enter it directly in the worksheet.
For example, to count a range of cells that contain a date before April 1, 2021, the formula used is “=COUNT(“Cell Range”, “<”&DATE (2021,4,1))”. The date is entered by using the DATE functionThe date function in excel is a date and time function representing the number provided as arguments in a date and time code. The result displayed is in date format, but the arguments are supplied as integers.read more.
Table of contents
- What Is COUNT In Excel?
- Syntax Of COUNT Excel Formula
- How To Use COUNT Function In Excel?
- Examples
- The Characteristics Of The COUNT Function
- Important Things To Note
- Frequently Asked Questions (FAQs)
- COUNT Function In Excel Video
- Download Template
- Recommended Articles
- In a given dataset, the COUNT function in Excel returns the count of the numeric values.
- It counts only the numbers and not the logical values, empty cells, text, or error values when the argument seems to be an array or reference.
- The usage of the COUNT and VBA (VBA Excel COUNT) functions are the same in Excel.
- The COUNTA function is a further extension of the COUNT function. It counts logical values, text, or error values. The COUNTIF function (another extension of the COUNT function) counts the numbers that meet a specified criterion.
Syntax Of COUNT Excel Formula
The syntax of the COUNT Excel formula is,
The arguments of the COUNT Excel formula are,
- value1, [value2], …, [value n]: It is a mandatory argument. It can range up to 255 values. The value can be a cell referenceCell reference in excel is referring the other cells to a cell to use its values or properties. For instance, if we have data in cell A2 and want to use that in cell A1, use =A2 in cell A1, and this will copy the A2 value in A1.read more or a range of values. It is a collection of worksheet cells containing a variety of data, out of which only the cells containing numbers are counted.
How To Use COUNT Function In Excel?
We can use the COUNT Excel function in 2 ways, namely:
- Access from the Excel ribbon.
- Enter in the worksheet manually.
Method #1 – Access from the Excel ribbon
Choose an empty cell for the result → select the “Formulas” tab → go to the “Function Library” group → click the “More Functions” option drop-down → click the “Statistical” option right arrow → select the “COUNT” function, as shown below.
The “Function Arguments” windowappears. Enter the arguments in the “Value1”, “Value2”, etc. fields, and click “OK”, as shown below.
Method #2 – Enter in the worksheet manually
- Select an empty cell for the output.
- Type =COUNT( in the selected cell. [Alternatively, type =C or =COU and double-click the COUNT function from the list of suggestions shown by Excel.
- Enter the argument as cell value or cell reference and close the brackets.
- Press the “Enter” key.
Basic Example – Count Numbers in the Given Range
Let us look at an example to apply the COUNT function to Count Numbers in the Given Range. (shown in the table below).
Select cell B10, enter the formula =COUNT(B3:B8), and press “Enter”.
The output is shown above. The range B3:B8 contains only three numeric values. Hence, the COUNT function returns 3.
Examples
We will consider some scenarios using COUNT Function in Excel examples. Each example covers a different case, implemented using the COUNT function.
Example #1 – Count Non-empty Cells
Let us apply the COUNTA functionThe COUNTA function is an inbuilt statistical excel function that counts the number of non-blank cells (not empty) in a cell range or the cell reference. For example, cells A1 and A3 contain values but, cell A2 is empty. The formula “=COUNTA(A1,A2,A3)” returns 2.
read more to the range of cells A1:A5 provided in the below table to find the count of the number of cells that are not empty.
Select cell B1, enter the formula =COUNTA(A1:A5), and press “Enter”.
The output is shown above. The COUNTA function counts the number of cells from A1 through A5 that contain some data. It returns the value as 4, as cells A1, A2, A3, and A4 are not empty, and only cell A5 is empty.
Example #2 – Count the Number of Valid Dates
Let us apply the COUNT function to count the number of valid dates to the range of cells C3:C8 (shown in the table below).
Select cell C10, enter the formula =COUNT(C3:C8), and press “Enter”.
The output is shown above. The range contains dates in different formats. Out of this, only two dates are valid. Hence, the formula returns 2.
Example #3 – Multiple Parameters
Let us apply the COUNT formula to the range of excel cells C3:C7 (provided in the table below) along with another parameter that is hard-coded with a value of 5.
Select cell C11, enter the formula =COUNTA(C3:C7,5), and press “Enter”.
The output is shown above. The number of cells (C3 through C7) with valid numeric values or dates is 2, plus 1 for the number 5. Hence the COUNT formula returns the result as 3 (cells C5, C6, and the number 5). Note that the date in cell C7 is invalid, and so is not taken into account in the given results.
Example #4 – Invalid Numbers
Let us apply the COUNT formula to the range of values B6:B8 (shown in the table below) containing invalid numbers.
Select cell B12, enter the formula =COUNTA(B6:B8), and press “Enter”.
The output is shown above. The range does not have any valid number. Hence, the result returned by the formula is 0, indicated in cell B12.
Example #5 – Empty Range
Let us apply the COUNT function to the range of values in cells D3:D5, which is an empty range.
Select cell D10, enter the formula =COUNTA(D3:D5), and press “Enter”.
The output is shown above. The given range does not have any numbers, and it is empty. Hence, the result returned by the formula is 0, indicated in cell D10.
The Characteristics Of The COUNT Function
The features of the COUNT Excel function are listed as follows:
- It counts the list of parameters containing the logical values and text representations.
- It does not count the error values or text which cannot be converted into numbers.
- It counts only the numbers and not the logical values, empty cells, text, or error values when the argument seems to be an array or reference.
- A further extension to the COUNT function is the COUNTA function. It counts logical values, text, or error values.
- Another extension of the COUNT function is the COUNTIF function, which counts the numbers that meet a specified criterion.
Important Things To Note
- Since the COUNT function has other related functions such as COUNTA, COUNTIF, COUNTBLANK, etc., we must ensure we enter the right function name to avoid getting a “#NAME?” error.
- In a selected cell range, the function ignores the blank cells, non-numeric cells, etc.
Frequently Asked Questions (FAQs)
1. How to use the Excel COUNT function?
The COUNT function provides the count of cells containing numbers within the given range of cells. It also counts numeric values within the list of arguments.
The formula of the COUNT in excel is =COUNT(value 1, [value 2],……, and so on).
2. What is the COUNTIF formula?
The COUNTIF function counts cells in a range that meets a single criterion. It counts cells that contain dates, numbers, and text.
The COUNTIF formula in excel is =COUNTIF(range, condition)
Here, the range is a series of cells to count.
3. What is the difference between the COUNT and COUNTA functions in Excel?
The COUNT function is generally used to count a range of cells containing numbers or dates. It excludes blank cells. And the COUNTA function, whichstands for count all, will count the numbers, dates, text, or a range containing a mixture of all these items. It does not count blank cells.
COUNT Function In Excel Video
Download Template
This article must help understand the COUNT function in Excel with its formulas and examples. You can download the template here to use it instantly.
You can download this COUNT Formula Excel Template here – COUNT Formula Excel Template
Recommended Articles
This is a guide to the COUNT Function in Excel. Here, we count number of cells with numeric values, COUNTA, COUNTIF, examples & a downloadable template. You may also look at the below useful functions in Excel –
- Example of COUNTIF with Multiple Criteria
- INT Function in Excel (Integer)INT or integer function in excel returns the nearest integer of a given number and is used when we have many data sets and each data in a different format.read more
- AVERAGE Function in Excel
We can count the total number of cells, rows, and column in a range by using the COLUMNS function and the ROWS function. The steps below will walk through the process.
Figure 1: Total number of Cells in the Range
=ROWS(range)*COLUMNS(range)
Setting up the Data to Count Total Cells in a Range
We will set up the data by imputing the values as shown in figure 2 into the various cells
- Cell A4 to Cell A12 will contain the Month
- Cell B4 to Cell B12 will contain the Ad cost for each month
- Cell C4, Cell C5, and Cell C6 will contain Columns, Rows, and Cells respectively
Figure 2: Setting up the Data
Counting the Total Columns in the Range (A4:B12)
We will input the formula below into Cell D4 to count the total number of columns in the range and press the enter key
=COLUMNS(A4:B12)
Figure 3: Result for the Total number of Columns in the Range
Counting the Total Rows in the Range (A4:B12)
We will input the formula below into Cell D5 to count the total number of rows in the range and press the enter key
Figure 4: Result for the Total number of Rows in the Range
Counting the Total Cells in the Range (A4:B12)
We can find the total number of cells by multiplying the cell references of the number of columns and number of rows that we have determined. We will input the formula below into Cell D6 to count the total number of cells in the range and press the enter key
=D4*D5
Figure 5A: Result for the Total number of Cells in the Range
Alternatively, we can use the formula that combines the row and column functions. With this formula, there is no need of calculating the number of rows and columns independently. We will input the formula below into Cell D6 and press the enter key
=ROWS(A4:B12)*COLUMNS(A4:B12)
Figure 5B: Result for the Total number of Cells in the Range
Explanation
- ROWS Function
This function retrieves the total number of rows that are present in the range.
- COLUMNS Function
This function retrieves the total number of columns that are present in the range.
Once the value of both functions have been returned, the multiplication sign multiplies both values and returns the result as the total cells in the range.
Instant Connection to an Expert through our Excelchat Service
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.
This wikiHow teaches you how to use the COUNT function in Excel to display the number of cells in a range.
Steps
-
1
Double-click your spreadsheet to open it in Excel. The contents of your spreadsheet will appear.
-
2
Click an empty cell. This cell is where the results of the COUNT function will appear.
-
3
Click the function (fx) button. It’s in the box right above your spreadsheet (toward the left side of the screen). This opens the “Insert Function” panel.
-
4
Select Recommended from the drop-down menu. This refines the list of functions.
-
5
Click COUNT in the list of functions. COUNT is now highlighted in a different color.
- The COUNT function counts the number of cells. It doesn’t add the numbers within the cells. If you want to add the numbers in the cells, use the SUM function.
-
6
Click OK. The Function Arguments panel will appear.
-
7
Click the button in the “Value1” blank. The panel will collapse.
-
8
Select the cells and press ↵ Enter. To do this, click the first cell in the range and then drag the mouse to include the rest of the cells. The cell range will appear next to “Value1” in the Function Arguments panel.
- If you want to add a second set of data to the count, click the button next to “Value2,” select additional cells, then press ↵ Enter.
-
9
Click OK. The count of selected cells now appears in the cell.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
About this article
Article SummaryX
1. Open your spreadsheet in Excel.
2. Click an empty cell.
3. Click the function button.
4. Select Recommended from the drop-down menu.
5. Click COUNT.
6. Click OK.
7. Click button next to «Value1.»
8. Select cells and press ENTER.
9. Click OK.
Did this summary help you?
Thanks to all authors for creating a page that has been read 189 times.