Difference between revisions of "Documentation/How Tos/Calc: COUNTA function"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Example:)
m (Example:)
Line 10: Line 10:
  
 
=== Example: ===
 
=== Example: ===
{| border="0"
 
|-valign="top"
 
|width="150pt"|<tt>'''COUNTA(B1:B3)'''</tt>
 
| where cells <tt>'''B1'''</tt>, <tt>'''B2'''</tt>, <tt>'''B3'''</tt> contain <tt>'''1.1'''</tt>, <tt>'''=NA()'''</tt>, <tt>'''apple'''</tt>  returns <tt>'''3'''</tt>, because none of the cells in <tt>'''B1:B3'''</tt> are empty.
 
  
|--valign="top"
+
<tt>'''COUNTA(B1:B3)'''</tt>
|<tt>'''COUNTA(2; 4; "dog")'''</tt>
+
| returns <tt>'''3'''</tt>, because <tt>'''2'''</tt>, <tt>'''4'''</tt> and <tt>'''"dog"'''</tt> are all numbers or text.
+
  
|--valign="top"
+
: where cells <tt>'''B1'''</tt>, <tt>'''B2'''</tt>, <tt>'''B3'''</tt> contain <tt>'''1.1'''</tt>, <tt>'''=NA()'''</tt>, <tt>'''apple'''</tt>  returns <tt>'''3'''</tt>, because none of the cells in <tt>'''B1:B3'''</tt> are empty.
|<tt>'''COUNTA(D1)'''</tt>
+
| where cell <tt>'''D1'''</tt> contains <tt>'''=""'''</tt>, returns <tt>'''1'''</tt>, because <tt>'''""'''</tt> is a string (although of zero length).
+
  
|}
+
<tt>'''COUNTA(2; 4; "dog")'''</tt>
 +
: returns <tt>'''3'''</tt>, because <tt>'''2'''</tt>, <tt>'''4'''</tt> and <tt>'''"dog"'''</tt> are all numbers or text.
 +
 
 +
<tt>'''COUNTA(D1)'''</tt>
 +
: where cell <tt>'''D1'''</tt> contains <tt>'''=""'''</tt>, returns <tt>'''1'''</tt>, because <tt>'''""'''</tt> is a string (although of zero length).
  
 
=== See also: ===
 
=== See also: ===
 
'''[[Documentation/How_Tos/Calc: COUNT function|COUNT function]]''', '''[[Documentation/How_Tos/Calc: COUNTIF function|COUNTIF function]]''', '''[[Documentation/How_Tos/Calc: COUNTBLANK function|COUNTBLANK function]]''', '''[[Documentation/How_Tos/Calc: SUM function|SUM function]]'''
 
'''[[Documentation/How_Tos/Calc: COUNT function|COUNT function]]''', '''[[Documentation/How_Tos/Calc: COUNTIF function|COUNTIF function]]''', '''[[Documentation/How_Tos/Calc: COUNTBLANK function|COUNTBLANK function]]''', '''[[Documentation/How_Tos/Calc: SUM function|SUM function]]'''

Revision as of 07:53, 2 December 2007


COUNTA

Counts the non-empty values in the list of arguments.

Syntax:

COUNTA(value1; value2; ... value30)

value1 to value30 are up to 30 values or ranges representing the values to be counted.

Example:

COUNTA(B1:B3)

where cells B1, B2, B3 contain 1.1, =NA(), apple returns 3, because none of the cells in B1:B3 are empty.

COUNTA(2; 4; "dog")

returns 3, because 2, 4 and "dog" are all numbers or text.

COUNTA(D1)

where cell D1 contains ="", returns 1, because "" is a string (although of zero length).

See also:

COUNT function, COUNTIF function, COUNTBLANK function, SUM function

Personal tools