# Documentation/Calc Functions/AGGREGATE/cs

This page is a translated version of the page Documentation/Calc Functions/AGGREGATE and the translation is 0% complete.
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎dansk • ‎español • ‎français • ‎čeština

AGGREGATE

Matematické

## Shrnutí:

AGGREGATE is a powerful but complex function that calculates a single number by applying a selected aggregate function to a specified set of data. Nineteen different aggregate functions are available.

Unlike many other functions that perform similar calculations, AGGREGATE provides options to omit certain unwanted data types from its processing. Options are available to ignore errors, hidden rows, and nested SUBTOTAL and other AGGREGATE function results.

## Syntaxe:

AGGREGATE(Function; Option; Number1[; Number2[; ... [; Number253]]])

or

AGGREGATE(Function; Option; Array; k)

The first syntax is intended for use with Function values 1 to 13, while the second syntax is intended for use with Function values 14 to 19.

## Vrátí:

Returns a numeric value that is the result of applying the selected aggregate function and ignore options to the specified set of data.

## Argumenty:

Function is an integer value in the range [1, 19], or a reference to a cell containing that number, which specifies the aggregate function to be used. The following table shows the mapping of these values to aggregate functions.

Function index Function applied
1 AVERAGE
2 COUNT
3 COUNTA
4 MAX
5 MIN
6 PRODUCT
7 STDEV.S
8 STDEV.P
9 SUM
10 VAR.S
11 VAR.P
12 MEDIAN
13 MODE.SNGL
14 LARGE
15 SMALL
16 PERCENTILE.INC
17 QUARTILE.INC
18 PERCENTILE.EXC
19 QUARTILE.EXC

Option is an integer value in the range [0, 7], or a reference to a cell containing that number, which specifies the ignore option to be used. The following table shows which data types are ignored for each value.

Option index Option applied
0 Ignore only nested SUBTOTAL and AGGREGATE functions
1 Ignore only hidden rows, nested SUBTOTAL and AGGREGATE functions
2 Ignore only errors, nested SUBTOTAL and AGGREGATE functions
3 Ignore hidden rows, errors, nested SUBTOTAL and AGGREGATE functions
4 Ignore nothing
5 Ignore only hidden rows
6 Ignore only errors
7 Ignore only hidden rows and errors

Number1, Number2, ..., Number253 are the numeric arguments to be processed when Function is in the range [1, 13]. These are similar to those of the standalone functions used for aggregation, see for example AVERAGE, COUNT, and MAX. Each argument may take one of the following forms:

• A number, or an expression that evaluates to a number.
• A reference to a single cell containing a number.
• A simple reference to a cell range containing numbers (for example, A1:B9).
• The name of a named range, comprising cells containing numbers.
• The name of a database range, comprising cells containing numbers.
• An inline array of numbers (for example, {1, 2, 3, 4}).
• The text of the heading label above a column of numbers, enclosed in single quotation marks - only available if Tools ▸ Options ▸ LibreOffice Calc ▸ Calculate ▸ Automatically find column and row labels option is enabled (LibreOffice ▸ Preferences ▸ LibreOffice Calc ▸ Calculate ▸ Automatically find column and row labels on macOS).

Array contains the numeric arguments to be processed when Function is in the range [14, 19]. This argument is similar to the Data argument of the standalone functions used for aggregation, see LARGE, PERCENTILE.EXC, PERCENTILE.INC, QUARTILE.INC, QUARTILE.EXC, and SMALL. The Array argument may take one of the forms listed above for Number1, Number2, ..., Number253.

k is required when Function is in the range [14, 19] and specifies the second argument required by the standalone aggregation function. These are as follows:

• LARGE requires a RankC argument (positive integer).
• SMALL requires a RankC argument (positive integer).
• PERCENTILE.INC requires an Alpha argument (real number in the range [0, 1]).
• PERCENTILE.EXC requires an Alpha argument (real number in the range (0, 1)).
• QUARTILE.INC requires a Type argument (integer in the range [0, 4]).
• QUARTILE.EXC requires a Type argument (integer in the range [1, 3]).

The following error conditions may be encountered:

• If either Function or Option is non-numeric, then AGGREGATE reports an invalid argument error (Err:502).
• If either Function or Option is not an integer, the value is truncated to its floor value.
• If Function is less than 1 or greater than 19, then AGGREGATE reports an invalid argument error (Err:502).
• If Option is less than 0 or greater than 7, then AGGREGATE reports an invalid argument error (Err:502).
• Other errors may be generated depending on the aggregate function selected and the data supplied. For example, a #DIV/0! error is generated if Function is set to 7 (STDEV.S) and only one data value is supplied. Another example occurs when a #VALUE! error is generated if Function is set to 13 (MODE.SNGL) and the supplied data contains no duplicate data points. More information about such error conditions can be found on the wiki pages for the standalone versions of the aggregate functions.

## Další detaily:

The AGGREGATE function is best used for columns of data, rather than rows of data, because hiding columns does not have any effect on the results of AGGREGATE.

The following table shows sample data that is used in the subsequent examples of the AGGREGATE function.

A B C
1 ColumnOne ColumnTwo ColumnThree
2 34 11 12
3 10 56 35
4 #DIV/0! 5 3
5 20 8 1
6 0 8 9
7 #VALUE! 20 21
8 5 7 8
9 14 0 5
Vzorec Popis Vrátí
=AGGREGATE(1; 4; 1; 2; 3; 4; 5; 6) Here the function returns the average value (Function set to 1) of the six supplied numbers (1 to 6, specified in the third to eighth arguments), ignoring nothing (Option set to 4). 3,5
=AGGREGATE(4; 2; A2:A9) Here the function returns the maximum value (Function set to 4) across the cell range A2:A9, ignoring hidden rows, and nested SUBTOTAL and AGGREGATE functions (Option set to 2).

This example demonstrates the power of AGGREGATE in comparison to the equivalent standalone functions. The formula =MAX(A2:A9) returns a #DIV/0! error, propagating the error in cell A4. If this error is fixed by some change to cell A4, then the formula =MAX(A2:A9) returns a #VALUE! error, propagating the error in A7. Using AGGREGATE avoids some of the data cleansing activity that might otherwise be required.
34
=AGGREGATE(9; 5; A5:C5) Here the function returns the sum (Function set to 9) across the cell range A5:C5, ignoring only hidden rows (Option set to 5). Note that the result remains unchanged as some or all of columns A-C are hidden. 29
=AGGREGATE(9; 5; B2:B9) Here the function returns the sum (Function set to 9) across the cell range B2:B9, ignoring only hidden rows (Option set to 5). Note that the result changes as any of rows 2:9 are hidden - for example, hiding row 7 changes the result to 95. 115
=AGGREGATE(2; 3; Sheet1.B2:Sheet3.B9) It is assumed that the document contains three sheets – with adjacent tabs Sheet1, Sheet2, and Sheet3 in the Sheet tabs area. It is further assumed that all these three tabs contain the same data in cells A1 to C9.

Here the function returns the count (Function set to 2) across the three dimensional cell range Sheet1.B2:Sheet3.B9, ignoring hidden rows, errors, and nested SUBTOTAL and AGGREGATE functions (Option set to 3).
24
=AGGREGATE(E3; E5; 'ColumnTwo') where cells E3 and E5 contain the numbers 13.3 and 4.7 respectively. It is assumed that the option Tools ▸ Options ▸ LibreOffice Calc ▸ Calculate ▸ Automatically find column and row labels is enabled (LibreOffice ▸ Preferences ▸ LibreOffice Calc ▸ Calculate ▸ Automatically find column and row labels on macOS).

Here the function returns the mode (Function set to truncated value of 13) of the values in ColumnTwo (cells B2:B9), ignoring nothing (Option set to truncated value of 4).
8
=AGGREGATE(15; 4; C2:C9, 3) Here the function returns the third (k set to 3) smallest (Function set to 15) of the values in the cell range C2:C9, ignoring nothing (Option set to 4). 5

None

AGGREGATE