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

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial content)
 
 
(14 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{DISPLAYTITLE:SUBTOTAL function}}
 +
{{Documentation/CalcFunc MathematicalTOC
 +
|ShowPrevNext=block
 +
|PrevPage=Documentation/How_Tos/Calc:_SQRTPI_function
 +
|NextPage=Documentation/How_Tos/Calc:_SUM_function
 +
}}__NOTOC__
  
 
== SUBTOTAL ==
 
== SUBTOTAL ==
Returns SUM, AVERAGE, STDDEV, etc. results for filtered data.
+
Returns SUM, AVERAGE, STDEV, etc. results for filtered data.
 
+
  
 
=== Syntax: ===
 
=== Syntax: ===
Line 36: Line 40:
 
|align="center"|11||VARP
 
|align="center"|11||VARP
 
|}
 
|}
 
  
 
: If <tt>'''range'''</tt> contains other <tt>'''SUBTOTAL'''</tt> functions they are ignored to avoid double counting.
 
: If <tt>'''range'''</tt> contains other <tt>'''SUBTOTAL'''</tt> functions they are ignored to avoid double counting.
 
  
 
=== Example: ===
 
=== Example: ===
 +
[[Image:Calc_subtotal_example.png|LEFT|example]]
 +
 
You have a table in the cell range A1:B5 containing cities in column A and accompanying figures in column B. You have used an AutoFilter so that you only see rows containing the city <tt>'''Hamburg'''</tt>. You want to see the sum of the figures that are displayed; that is, just the subtotal for the filtered rows.
 
You have a table in the cell range A1:B5 containing cities in column A and accompanying figures in column B. You have used an AutoFilter so that you only see rows containing the city <tt>'''Hamburg'''</tt>. You want to see the sum of the figures that are displayed; that is, just the subtotal for the filtered rows.
  
<tt>'''SUBTOTAL(9; B2:B5)'''</tt>
+
<tt>'''SUBTOTAL(9; B1:B5)'''</tt>
 
: returns the desired result.
 
: returns the desired result.
 +
<br clear="all" />
  
 
+
{{SeeAlso|EN|
=== See also: ===
+
* [[Documentation/How_Tos/Calc: AVERAGE function|AVERAGE]]
'''[[Documentation/How_Tos/Calc: AVERAGE function|AVERAGE]]''',
+
* [[Documentation/How_Tos/Calc: COUNT function|COUNT]]
'''[[Documentation/How_Tos/Calc: COUNT function|COUNT]]''',
+
* [[Documentation/How_Tos/Calc: COUNTA function|COUNTA]]
'''[[Documentation/How_Tos/Calc: COUNTA function|COUNTA]]''',
+
* [[Documentation/How_Tos/Calc: MAX function|MAX]]
'''[[Documentation/How_Tos/Calc: MAX function|MAX]]''',
+
* [[Documentation/How_Tos/Calc: MIN function|MIN]]
'''[[Documentation/How_Tos/Calc: MIN function|MIN]]''',
+
* [[Documentation/How_Tos/Calc: PRODUCT function|PRODUCT]]
'''[[Documentation/How_Tos/Calc: PRODUCT function|PRODUCT]]''',
+
* [[Documentation/How_Tos/Calc: STDEV function|STDEV]]
'''[[Documentation/How_Tos/Calc: STDEV function|STDEV]]''',
+
* [[Documentation/How_Tos/Calc: STDEVP function|STDEVP]]
'''[[Documentation/How_Tos/Calc: STDEVP function|STDEVP]]''',
+
* [[Documentation/How_Tos/Calc: SUM function|SUM]]
'''[[Documentation/How_Tos/Calc: SUM function|SUM]]''',
+
* [[Documentation/How_Tos/Calc: VAR function|VAR]]
'''[[Documentation/How_Tos/Calc: VAR function|VAR]]''',
+
* [[Documentation/How_Tos/Calc: VARP function|VARP]]
'''[[Documentation/How_Tos/Calc: VARP function|VARP]]''',
+
  
 
'''Filtering Cell Ranges'''
 
'''Filtering Cell Ranges'''
  
'''[[Documentation/How_Tos/Calc: Mathematical functions|Mathematical functions]]'''
+
* [[Documentation/How_Tos/Calc: Mathematical functions|Mathematical functions]]
 +
 
 +
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
 +
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}}
 +
[[Category: Documentation/Reference/Calc/Mathematical functions]]
 +
[[fr:Documentation/FR/Calc:Fonction SOUS.TOTAL]]

Latest revision as of 15:45, 31 January 2024

SUBTOTAL

Returns SUM, AVERAGE, STDEV, etc. results for filtered data.

Syntax:

SUBTOTAL(function; range)

range is the overall range from which cells for calculation are selected by filtering.
function is a number that specifies the function to calculate, as follows:
function Function
1 AVERAGE
2 COUNT
3 COUNTA
4 MAX
5 MIN
6 PRODUCT
7 STDEV
8 STDEVP
9 SUM
10 VAR
11 VARP
If range contains other SUBTOTAL functions they are ignored to avoid double counting.

Example:

example

You have a table in the cell range A1:B5 containing cities in column A and accompanying figures in column B. You have used an AutoFilter so that you only see rows containing the city Hamburg. You want to see the sum of the figures that are displayed; that is, just the subtotal for the filtered rows.

SUBTOTAL(9; B1:B5)

returns the desired result.




See Also

Filtering Cell Ranges

Retrieved from "https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Calc:_SUBTOTAL_function&oldid=259907"
Views
Personal tools
Navigation
Print/export
Tools
In other languages