Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeTheAppleBytesLatest imagesMailRegisterLog in

Share | 
 

 'COUNT' Function in MS Excel.

View previous topic View next topic Go down 
AuthorMessage
PHOENiX.505
Administrator
Administrator


Location : Noida, India
iPoints : 63550
Warning Level : Safe

'COUNT' Function in MS Excel. Empty
PostSubject: 'COUNT' Function in MS Excel.   'COUNT' Function in MS Excel. Icon_minitime11th April 2011, 6:13 pm

Count Cells with Numbers - 'COUNT'

The Excel COUNT function will count cells that contain numbers. Its syntax is:
=COUNT(value1, value2,...value30).
The arguments (e.g. value1) can be cell references, or values typed into the Excel COUNT formula.

The following Excel COUNT function example uses one argument -- a reference to cells A1:A5.

'COUNT' Function in MS Excel. Count010
Enter the sample data on your worksheet
In cell A7, enter an Excel COUNT formula, to count the numbers in column A: =COUNT(A1:A5)
Press the Enter key, to complete the formula.
The result will be 3, the number of cells that contain numbers.
Cell A1 isn't counted, because it contains text.

Count Cells with Data - 'COUNTA'

The COUNTA function will count cells that are not empty. Its syntax is:
=COUNTA(value1, value2,...value30).
The arguments (e.g. value1) can be cell references, or values typed into the formula. The following example uses one argument -- a reference to cells A1:A5.

'COUNT' Function in MS Excel. Count011
Enter the sample data on your worksheet
In cell A7, enter a COUNTA formula, to count the numbers in column A: =COUNTA(A1:A5)
Press the Enter key, to complete the formula.
The result will be 4, the number of cells that contain data.
Note: COUNTA will count cells with formulas — including those that look empty, because they evaluate to "", e.g. =IF(B2="","",B2). It will also count cells which had formulas that evaluated to "", but then were converted to values (Edit | Paste Special, Values). You can see apostrophes in those "non-blank" converted cells, if you add a check mark to Tools | Options, Transition tab, "Transition navigation keys."

Count Blank Cells - 'COUNTBLANK'

The COUNTBLANK function will count cells that are empty. Its syntax is:
=COUNTBLANK(range).
The following example uses a reference to cells A1:A5.

'COUNT' Function in MS Excel. Count110
Enter the sample data on your worksheet
In cell A7, enter a COUNTBLANK formula, to count the numbers in column A: =COUNTBLANK(A1:A5)
Press the Enter key, to complete the formula.
The result will be 1, the number of empty cells.
Note: COUNTBLANK will count cells with formulas — including those that look empty, because they evaluate to "", e.g. =IF(B2="","",B2). It will also count cells which had formulas that evaluated to "", but then were converted to values (Edit | Paste Special, Values). You can see apostrophes in those "non-blank" converted cells, if you add a check mark to Tools | Options, Transition tab, "Transition navigation keys."

Count cells that match criteria - 'COUNTIF'

Match criterion exactly

In Excel, count cells that meet a specific criterion. In this example only the Pen orders will be counted.

Select the cell in which you want to see the count (cell A12 in this example)
Type an equal sign (=) to start the formula
Type: COUNTIF(
Select the cells that contain the values to check for the criterion. In this example, cells A1:A10 will be checked
Type a comma, to separate the arguments
Type the criterion. In this example, you're checking for text, so type the word in double quotes: "Pen"
Note: upper and lower case are treated equally
Type a closing bracket
The completed formula is: =COUNTIF(A1:A10,"Pen")
Press the Enter key to complete the entry
The result will be 4, the number of cells that contain "Pen"

'COUNT' Function in MS Excel. Count012

Match criterion in a string

In Excel, count cells that contain a criterion as part of the cell's contents. In this example all Pen, Gel Pen, and Pencil orders will be counted, because they contain the string "pen".

Select the cell in which you want to see the count (cell A12 in this example)
Type an equal sign (=) to start the formula
Type: COUNTIF(
Select the cells that contain the values to check for the criterion. In this example, cells A1:A10 will be checked
Type a comma, to separate the arguments
Type the criterion. In this example, you're checking for text, so type the word in double quotes, with one or more asterisk (*) wildcard characters: "*Pen*"
Note: upper and lower case are treated equally
Type a closing bracket
The completed formula is: =COUNTIF(A1:A10,"*Pen*")
Press the Enter key to complete the entry
The result will be 6, the number of cells that contain the string, "Pen"
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 7 above could be changed to:
=COUNTIF(A1:A10,"*" & B12 & "*")
if cell B12 contained the text — pen.

'COUNT' Function in MS Excel. Count013

Criterion and operator

You can use an operator with a criterion. In this example only the rows where the quantity is greater than or equal to ten will be counted.

Select the cell in which you want to see the count (cell A12 in this example)
Type an equal sign (=) to start the formula
Type: COUNTIF(
Select the cells that contain the values to check for the criterion. In this example, cells B1:B10 will be checked
Type a comma, to separate the arguments
Type the criterion. In this example, you're checking for rows where the quantity is greater than or equal to 10. The >= operator is used before the number, and the entire criterion is enclosed in double quotes: ">=10"
Note: Even though this is a numerical criterion, it must enclosed in double quote marks.
Type a closing bracket
The completed formula is:
=COUNTIF(B1:B10,">=10")
Press the Enter key to complete the entry
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 8 above could be changed to:
=COUNTIF(B1:B10,">=" & B12)
if cell B12 contained the number — 10.

Or, you could use a function as part of the criterion. For example:
=COUNTIF(A1:A10,"<"&TODAY())

'COUNT' Function in MS Excel. Count014

Match criteria in a range

You can combine COUNTIF formulas, to count rows that are within a range of values. In this example, the formula will count rows where the quantity is between 5 and 10 (inclusive).

Select the cell in which you want to see the count (cell A12 in this example)
Type a formula to count rows greater than or equal to 5:
=COUNTIF(B1:B10,">=5")
Type a minus sign
Type a formula to count rows greater than 10:
COUNTIF(B1:B10,">10")
The completed formula is:
=COUNTIF(B1:B10,">=5")-COUNTIF(B1:B10,">10")
Press the Enter key to complete the entry
Note: Instead of typing the criterion in a formula, you can refer to a cell. For example, the formula in step 8 above could be changed to:
=COUNTIF(B1:B10,">=" & B12) -
COUNTIF(B1:B10,">" & C12)
if cell B12 contained the number — 5 and cell C12 contained the number — 10.

'COUNT' Function in MS Excel. Count111

Count cells that match multiple criteria - 'SUMPRODUCT'

Match multiple criteria

In Excel, count rows that meet two or more criteria. In this example only the rows where the item is "Pen" and the quantity is greater than or equal to ten will be counted.

Select the cell in which you want to see the total
Type an equal sign (=) to start the formula
Type: SUMPRODUCT(--(
Select the cells that contain the values to check for the first criterion. In this example, cells A2:A10 will be checked
Type the first criterion: ="Pen"
Note: Because this is a text criterion, it is enclosed in double quote marks.
Type ),--(
Select the cells that contain the values to check for the second criterion. In this example, cells B2:B10 will be checked
Type the second criterion: >=10
Note: Because this is a numerical criterion, it isn't enclosed in double quote marks.
Finish with closing brackets: ))
The completed formula is shown at right.
Press the Enter key to complete the entry
Note: Instead of typing the criterion in a formula, you can refer to a cell, as shown in the second formula at right
'COUNT' Function in MS Excel. Count015

Count Rows in a Filtered List - 'SUBTOTAL'

After you filter the rows in a list, you can use the SUBTOTAL function to count the visible rows.

Apply an AutoFilter to the table. There are instructions here -- AutoFilter Basics
Filter at least one of the columns in the table. In this example, the first column has been filtered for Binders.
Select the cell immediately below the column you want to sum.
Click the AutoSum button on the Excel's Standard toolbar.
If you want the SUBTOTAL function in a cell other than the one directly below the filtered list, you can type the formula, instead of using the AutoSum button.
A SUBTOTAL formula will be automatically inserted, totalling the visible cells in the column
The first argument in the SUBTOTAL function is a function number, that specifies how the numbers should be calculated. The default is 9, which tells Excel to SUM the numbers.
Other function numbers can be used, such as 1 for AVERAGE, and 3 for COUNTA. Look in Excel's Help for a complete list.
To Count all the non-empty cells in column D, use a 3 as the first argument:
=SUBTOTAL(3,D2:D10)
Press the Enter key to complete the formula entry.
Note: In Excel 2003, you can use the formula:
=SUBTOTAL(103,D2:D10)
to subtotal rows which have been manually hidden, or filtered.

'COUNT' Function in MS Excel. Count016

Count Visible Items in a Filtered List

Incorporating that technique, SUMPRODUCT can be used to count visible items in a filtered table. In the following example, column D has been filtered for amounts greater than 100. The following formula will count the number of visible rows that contain "Pen" in column A.

From the dropdown list in cell D1, select Custom.
Filter for rows greater than 100.
In cell A12, type: Pen
In cell B12, enter the following formula:

=SUMPRODUCT(SUBTOTAL(3,OFFSET(A1:A10,ROW(A1:A10)
-MIN(ROW(A1:A10)),,1)), --(A1:A10=A12))

Press the Enter key to complete the formula entry.
'COUNT' Function in MS Excel. Count017
Back to top Go down
http://www.theapplebytes.com
 

'COUNT' Function in MS Excel.

View previous topic View next topic Back to top 

 Similar topics

-
» Creating a "Splash Screen" for a Excel Workbook.
» Hide Cell Contents in Microsoft Excel
» Break Excel Workbook Internal Passwords using a Macro
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: . . : : Tips Tricks & Tweaks : : . . :: . . : : Microsoft Office : : . . :: . . : : Microsoft Excel : : . .-
Create free forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com
© Copyright TheAppleBytes | All Rights Reserved.