ExcelScript.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

/**
 * This script applies a PivotValueFilter to the first row hierarchy in the PivotTable.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the PivotTable on the current worksheet.
  let sheet = workbook.getActiveWorksheet();
  let pivotTable = sheet.getPivotTables()[0];

  // Get the first row hierarchy to use as the field which gets filtered.
  let rowHierarchy = pivotTable.getRowHierarchies()[0];

  // Get the first data hierarchy to use as the values for filtering the rows.
  let dataHierarchy = pivotTable.getDataHierarchies()[0];

  // Create a filter that excludes values greater than 500.
  let filter: ExcelScript.PivotValueFilter = {
    condition: ExcelScript.ValueFilterCondition.greaterThan,
    comparator: 500,
    value: dataHierarchy.getName()
  };

  // Apply the filter.
  rowHierarchy.getPivotField(rowHierarchy.getName()).applyFilter({
    valueFilter: filter
  });
}

Fields

between

Between lowerBound and upperBound criteria.

Required Criteria: {value, lowerBound, upperBound}. Optional Criteria: {exclusive}.

bottomN

In bottom N (threshold) [items, percent, sum] of value category.

Required Criteria: {value, threshold, selectionType}.

equals

Equals comparator criterion.

Required Criteria: {value, comparator}. Optional Criteria: {exclusive}.

greaterThan

Greater than comparator criterion.

Required Criteria: {value, comparator}.

greaterThanOrEqualTo

Greater than or equal to comparator criterion.

Required Criteria: {value, comparator}.

lessThan

Less than comparator criterion.

Required Criteria: {value, comparator}.

lessThanOrEqualTo

Less than or equal to comparator criterion.

Required Criteria: {value, comparator}.

topN

In top N (threshold) [items, percent, sum] of value category.

Required Criteria: {value, threshold, selectionType}.

unknown

ValueFilterCondition is unknown or unsupported.