ExcelScript.LabelFilterCondition enum

Enum representing all accepted conditions by which a label filter can be applied. Used to configure the type of PivotFilter that is applied to the field. PivotFilter.criteria.exclusive can be set to true to invert many of these conditions.

Remarks

Examples

/**
 * This script filters items that start with "L" from the "Type" field
 * of the "Farm Sales" PivotTable.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the PivotTable.
  const pivotTable = workbook.getActiveWorksheet().getPivotTable("Farm Sales");

  // Get the "Type" field.
  const field = pivotTable.getHierarchy("Type").getPivotField("Type");

  // Filter out any types that start with "L" (such as "Lemons" and "Limes").
  const filter: ExcelScript.PivotLabelFilter = {
    condition: ExcelScript.LabelFilterCondition.beginsWith,
    substring: "L",
    exclusive: true
  };

  // Apply the label filter to the field.
  field.applyFilter({ labelFilter: filter });
}

Fields

beginsWith

Label begins with substring criterion.

Required Criteria: {substring}. Optional Criteria: {exclusive}.

between

Between lowerBound and upperBound criteria.

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

contains

Label contains substring criterion.

Required Criteria: {substring}. Optional Criteria: {exclusive}.

endsWith

Label ends with substring criterion.

Required Criteria: {substring}. Optional Criteria: {exclusive}.

equals

Equals comparator criterion.

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

greaterThan

Greater than comparator criterion.

Required Criteria: {comparator}.

greaterThanOrEqualTo

Greater than or equal to comparator criterion.

Required Criteria: {comparator}.

lessThan

Less than comparator criterion.

Required Criteria: {comparator}.

lessThanOrEqualTo

Less than or equal to comparator criterion.

Required Criteria: {comparator}.

unknown

LabelFilterCondition is unknown or unsupported.