You can set the visual appearance of cells using rules. The following classes are available when creating conditional formatting with rules:
- AverageConditionalFormattingRule Class
- BetweenValuesConditionalFormattingRule Class
- BlankConditionalFormattingRule Class
- DatabarConditionalFormattingRule Class
- FormulaConditionalFormattingRule Class
- ErrorConditionalFormattingRule Class
- IconSetConditionalFormattingRule Class
- PrePaintConditionalFormattingRule Class
- PrePaintTextConditionalFormattingRule Class
- TextConditionalFormattingRule Class
- ThreeColorScaleConditionalFormattingRule Class
- TimePeriodConditionalFormattingRule Class
- TopRankedValuesConditionalFormattingRule Class
- TwoColorScaleConditionalFormattingRule Class
- UnaryComparisonConditionalFormattingRule Class
- UniqueOrDuplicatedConditionalFormattingRule Class
The average rule checks for values above or under the average. The cell value rule compares values. The date rule compares dates. The formula rule allows you to use formulas when checking the condition. The scale rule uses a sliding color scale. For example if 1 is yellow and 50 is green, then 25 would be light green. The specific text rule searches for text strings. The top 10 rule checks for values in the top or bottom of the range. The unique rule checks to see if the value is the only one of that value in the range (if the duplicate option is false). The duplicate rule checks for duplicate values.
The data bar rule displays a bar in the cell based on the cell value in the range. The icon set rule displays icons based on the values.
You can add rules with the SetConditionalFormatting method or the ConditionalFormatting class.
The following topics provide additional information about specific conditional formatting rules.