ExcelScript.AggregationFunction enum
Aggregation function for the DataPivotHierarchy
.
Remarks
Examples
/**
* This script changes how the data in a PivotTable is aggregated.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the first PivotTable in the workbook.
const pivotTable = workbook.getPivotTables()[0];
// Set the first data hierarchy to summarize with an average value, instead of a sum.
const dataHierarchy = pivotTable.getDataHierarchies()[0];
dataHierarchy.setSummarizeBy(ExcelScript.AggregationFunction.average);
}
Fields
automatic | Excel will automatically select the aggregation based on the data items. |
average | Aggregate using the average of the data, equivalent to the AVERAGE function. |
count | Aggregate using the count of items in the data, equivalent to the COUNTA function. |
countNumbers | Aggregate using the count of numbers in the data, equivalent to the COUNT function. |
max | Aggregate using the maximum value of the data, equivalent to the MAX function. |
min | Aggregate using the minimum value of the data, equivalent to the MIN function. |
product | Aggregate using the product of the data, equivalent to the PRODUCT function. |
standardDeviation | Aggregate using the standard deviation of the data, equivalent to the STDEV function. |
standardDeviationP | Aggregate using the standard deviation of the data, equivalent to the STDEVP function. |
sum | Aggregate using the sum of the data, equivalent to the SUM function. |
unknown | Aggregation function is unknown or unsupported. |
variance | Aggregate using the variance of the data, equivalent to the VAR function. |
varianceP | Aggregate using the variance of the data, equivalent to the VARP function. |
Office Scripts