Excel.AggregationFunction enum
Aggregation function for the DataPivotHierarchy
.
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-filters-and-summaries.yaml
async function genericFunctionSwitch(functionType: Excel.AggregationFunction) {
await Excel.run(async (context) => {
const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");
pivotTable.dataHierarchies.load("no-properties-needed");
await context.sync();
pivotTable.dataHierarchies.items[0].summarizeBy = functionType;
pivotTable.dataHierarchies.items[1].summarizeBy = functionType;
await context.sync();
});
}
Fields
automatic = "Automatic" | Excel will automatically select the aggregation based on the data items. |
average = "Average" | Aggregate using the average of the data, equivalent to the AVERAGE function. |
count = "Count" | Aggregate using the count of items in the data, equivalent to the COUNTA function. |
countNumbers = "CountNumbers" | Aggregate using the count of numbers in the data, equivalent to the COUNT function. |
max = "Max" | Aggregate using the maximum value of the data, equivalent to the MAX function. |
min = "Min" | Aggregate using the minimum value of the data, equivalent to the MIN function. |
product = "Product" | Aggregate using the product of the data, equivalent to the PRODUCT function. |
standardDeviation = "StandardDeviation" | Aggregate using the standard deviation of the data, equivalent to the STDEV function. |
standardDeviationP = "StandardDeviationP" | Aggregate using the standard deviation of the data, equivalent to the STDEVP function. |
sum = "Sum" | Aggregate using the sum of the data, equivalent to the SUM function. |
unknown = "Unknown" | Aggregation function is unknown or unsupported. |
variance = "Variance" | Aggregate using the variance of the data, equivalent to the VAR function. |
varianceP = "VarianceP" | Aggregate using the variance of the data, equivalent to the VARP function. |
Office Add-ins