Difference between revisions of "Documentation/How Tos/Calc: DSUM function"
From Apache OpenOffice Wiki
< Documentation | How Tos
(Initial content) |
|||
Line 22: | Line 22: | ||
=== Example: === | === Example: === | ||
− | + | In this spreadsheet: | |
+ | {| border="1" | ||
+ | |-align="center" | ||
+ | | ||'''A'''||B'''||C'''||'''D'''||'''E''' | ||
+ | |-align="center" | ||
+ | |'''1'''||Name||Grade||Age||Distance to School||Weight | ||
+ | |||
+ | |-align="center" | ||
+ | |'''2'''||Andy||3||9||150||40 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''3'''||Betty||4||10||1000||42 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''4'''||Charles||3||10||300||51 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''5'''||Daniel||5||11||1200||48 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''6'''||Eva||2||8||650||33 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''7'''||Frank||2||7||300||42 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''8'''||Greta||1||7||200||36 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''9'''||Harry||3||9||1200||44 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''10'''||Irene||2||8||1000||42 | ||
+ | |||
+ | |-align="center" | ||
+ | |'''11'''|| || || || || | ||
+ | |||
+ | |-align="center" | ||
+ | |'''12'''|| || || || || | ||
+ | |||
+ | |-align="center" | ||
+ | |'''13'''||Name||Grade||Age||Distance to School||Weight | ||
+ | |||
+ | |-align="center" | ||
+ | |'''14'''|| ||2|| || || | ||
+ | |||
+ | |} | ||
+ | |||
+ | |||
+ | <tt>'''DSUM(A1:E10; "Distance to School"; A13:E14)'''</tt> | ||
+ | |||
+ | : returns the combined distance to school of all children who are in the second grade. | ||
Line 32: | Line 83: | ||
'''[[Documentation/How_Tos/Calc: DCOUNT function|DCOUNT function]]''', | '''[[Documentation/How_Tos/Calc: DCOUNT function|DCOUNT function]]''', | ||
'''[[Documentation/How_Tos/Calc: DCOUNTA function|DCOUNTA function]]''', | '''[[Documentation/How_Tos/Calc: DCOUNTA function|DCOUNTA function]]''', | ||
− | |||
'''[[Documentation/How_Tos/Calc: DPRODUCT function|DPRODUCT function]]''', | '''[[Documentation/How_Tos/Calc: DPRODUCT function|DPRODUCT function]]''', | ||
Revision as of 06:55, 1 December 2007
DSUM
Conditionally sums the contents of cells in a Calc 'database' table.
Syntax:
DSUM(database_table; field; criteria_table)
where
- database_table is a range defining the data to be processed.
- field is the column to count. It may be a cell, the column number (A=1, B=2, etc)??, the column header (enclosed in quotation marks ””) or 0 (which includes the whole database table.
- criteria_table is a range containing the criteria to use
The Database functions overview describes the use of these parameters.
Example:
In this spreadsheet:
A | B | C | D | E | |
1 | Name | Grade | Age | Distance to School | Weight |
2 | Andy | 3 | 9 | 150 | 40 |
3 | Betty | 4 | 10 | 1000 | 42 |
4 | Charles | 3 | 10 | 300 | 51 |
5 | Daniel | 5 | 11 | 1200 | 48 |
6 | Eva | 2 | 8 | 650 | 33 |
7 | Frank | 2 | 7 | 300 | 42 |
8 | Greta | 1 | 7 | 200 | 36 |
9 | Harry | 3 | 9 | 1200 | 44 |
10 | Irene | 2 | 8 | 1000 | 42 |
11 | |||||
12 | |||||
13 | Name | Grade | Age | Distance to School | Weight |
14 | 2 |
DSUM(A1:E10; "Distance to School"; A13:E14)
- returns the combined distance to school of all children who are in the second grade.
See also:
DCOUNT function, DCOUNTA function, DPRODUCT function,
DMAX function, DMIN function, DAVERAGE function,
DSTDEV function, DSTDEVP function, DVAR function, DVARP function,