Excel.ValueFilterCondition enum
Enum representing all accepted conditions by which a value filter can be applied. Used to configure the type of PivotFilter that is applied to the field. PivotFilter.exclusive
can be set to true
to invert many of these conditions.
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/38-pivottable/pivottable-pivotfilters.yaml
await Excel.run(async (context) => {
// Add a PivotFilter to filter on the values correlated with a row.
// Get the PivotTable.
const pivotTable = context.workbook.worksheets.getActiveWorksheet().pivotTables.getItem("Farm Sales");
// Get the "Farm" field.
const field = pivotTable.hierarchies.getItem("Farm").fields.getItem("Farm");
// Filter to only include rows with more than 500 wholesale crates sold.
const filter: Excel.PivotValueFilter = {
condition: Excel.ValueFilterCondition.greaterThan,
comparator: 500,
value: "Sum of Crates Sold Wholesale"
};
// Apply the value filter to the field.
field.applyFilter({ valueFilter: filter });
await context.sync();
});
Fields
between = "Between" | Between Required Criteria: { |
bottomN = "BottomN" | In bottom N ( Required Criteria: { |
equals = "Equals" | Equals comparator criterion. Required Criteria: { |
greaterThan = "GreaterThan" | Greater than comparator criterion. Required Criteria: { |
greaterThanOrEqualTo = "GreaterThanOrEqualTo" | Greater than or equal to comparator criterion. Required Criteria: { |
lessThan = "LessThan" | Less than comparator criterion. Required Criteria: { |
lessThanOrEqualTo = "LessThanOrEqualTo" | Less than or equal to comparator criterion. Required Criteria: { |
topN = "TopN" | In top N ( Required Criteria: { |
unknown = "Unknown" |
|
Office Add-ins