Cmdlet
Add-OfficeExcelConditionalRule
Adds a conditional formatting rule to the current worksheet.
Syntax
Add-OfficeExcelConditionalRule
[-EqualAverage]
[[-Formula1] <String>]
[-Formula2 <String>]
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[[-Operator] <ExcelConditionalFormattingOperator>]
[-PassThru]
[-Percent]
[-PivotTableName <String>]
[-PivotWholeTable]
[[-Range] <String>]
[-Rank <UInt32>]
[-RuleType <OfficeExcelConditionalRuleType>]
[-StandardDeviation <UInt32>]
[-StopIfTrue]
[-TableName <String>]
[-Text <String>]
[-TimePeriod <ExcelConditionalTimePeriod>]
[<CommonParameters>]#Parameter set:
ContextAdd-OfficeExcelConditionalRule
-Document <ExcelDocument>
[-EqualAverage]
[[-Formula1] <String>]
[-Formula2 <String>]
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[[-Operator] <ExcelConditionalFormattingOperator>]
[-PassThru]
[-Percent]
[-PivotTableName <String>]
[-PivotWholeTable]
[[-Range] <String>]
[-Rank <UInt32>]
[-RuleType <OfficeExcelConditionalRuleType>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-StandardDeviation <UInt32>]
[-StopIfTrue]
[-TableName <String>]
[-Text <String>]
[-TimePeriod <ExcelConditionalTimePeriod>]
[<CommonParameters>]#Parameter set:
DocumentExamples
Highlight values greater than 100.
ExcelSheet 'Data' { Add-OfficeExcelConditionalRule -Range 'C2:C100' -Operator GreaterThan -Formula1 '100' }Applies a conditional rule to column C.
Parameters
- -EqualAverage SwitchParameter
- Include values equal to the average for average rules.
- -Formula1 String
- Primary formula or value.
- -Formula2 String
- Optional secondary formula or value.
- -HeaderName String
- Header or table column name used to resolve the target range.
- -HeaderRow Int32
- Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
- -IncludeHeader SwitchParameter
- Include the header cell in the resolved range.
- -Operator ExcelConditionalFormattingOperator
- Conditional formatting operator.
- Possible values:
LessThan,LessThanOrEqual,Equal,NotEqual,GreaterThanOrEqual,GreaterThan,Between,NotBetween,ContainsText,NotContains,BeginsWith,EndsWith - -PassThru SwitchParameter
- Emit the range after applying the rule.
- -Percent SwitchParameter
- Treat top/bottom rank as a percent.
- -PivotTableName String
- Pivot table name used to resolve the target range.
- -PivotWholeTable SwitchParameter
- Use the full pivot output range instead of the default data body range.
- -Range String
- A1 range to apply the rule to.
- -Rank UInt32
- Rank used by top/bottom rules.
- -RuleType OfficeExcelConditionalRuleType
- Rule type to author.
- Possible values:
CellIs,Expression,Formula,DuplicateValues,UniqueValues,Top,Top10,Bottom,Bottom10,AboveAverage,BelowAverage,ContainsText,NotContainsText,BeginsWith,EndsWith,ContainsBlanks,NotContainsBlanks,ContainsErrors,NotContainsErrors,TimePeriod - -StandardDeviation UInt32
- Optional standard deviation threshold for average rules.
- -StopIfTrue SwitchParameter
- Stop evaluating later rules when this rule is true.
- -TableName String
- Optional table name for header-based range resolution.
- -Text String
- Text used by text-matching rule types.
- -TimePeriod ExcelConditionalTimePeriod
- Time period used by time-period rules.
- Possible values:
Today,Yesterday,Tomorrow,Last7Days,ThisMonth,LastMonth,NextMonth,ThisWeek,LastWeek,NextWeek - -Document ExcelDocument
- Workbook to operate on outside the DSL context.
- -Sheet String
- Worksheet name when using Document.
- -SheetIndex Int32
- Worksheet index (0-based) when using Document.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.