In Excel you can count the content of cells that meet different criteria in several
different ways. These are some of the functions that can be used:
The following examples demonstrate the COUNT functions listed above. The range address may be replaced with a defined name
(e.g. MyRange). In this example a semicolon (;) is used as the list separator, repace with a
comma (,) if necessary.
Description |
Formula |
Counts the values in the range E4:E23 |
=COUNT(E4:E23) |
Counts all non-blank cells in the range E4:E23 |
=COUNTA(E4:E23) |
Counts blank cells in the range E4:E23 |
=COUNTBLANK(E2:E23) |
Counts all values greater than 0 |
=COUNTIF(E4:E23;">0") |
Counts all values less than 0 |
=COUNTIF(E4:E23;"<0") |
Counts all cells containing the text yes |
=COUNTIF(F4:F23;"yes") |
Counts all cells containing text starting with k |
=COUNTIF(F4:F23;"k*") |
Counts all cells containing text with the letter a |
=COUNTIF(F4:F23;"*a*") |
Counts all cells containing the text yes or no |
=COUNTIF(F4:F23;"yes")+COUNTIF(F4:F23;"no") |
Same as above with an array formula |
{=SUM((F4:F23="yes")+(F4:F23="no"))} |
Counts all cells containing 3 characters |
=COUNTIF(F4:F23;"???") |
Counts all cells with values between 30 and 80 |
=COUNTIF(E4:E23;">=30")-COUNTIF(E4:E23;">80") |
Counts all unique numbers in the range |
=SUM(IF(FREQUENCY(E4:E23;E4:E23)>0;1;0)) |
Counts all odd numbers in the range (array formula) |
{=SUM(MOD(G4:G23;2))} |
Counts all even numbers in the range (array formula) |
{=SUM(IF(MOD(G4:G23;2)=0;1;0))} |
Counts cells with an AND-criteria (array formula) |
{=SUM(IF((F4:F23="yes")*(G4:G23>10);1;0))} |
Counts cells with an AND-criteria (array formula) |
{=SUM((F5:F24="yes")*(G5:G24>10))} |
Counts cells with an OR-criteria (array formula) |
{=SUM((F4:F23="yes")+(F4:F23="no"))} |