Color scales are visual guides that help you understand data distribution and variation. A two-color scale compares a range of cells by using a gradation of two colors. The shade of the color represents higher or lower values. For example, in a green and red color scale, you can specify that higher value cells are closer to a green color and lower value cells are closer to a red color. You can specify the value type, value, and color for the minimum and maximum properties.
A three-color scale compares a range of cells by using a gradation of three colors. The shade of the color represents higher, middle, or lower values. For example, in a green, yellow, and red color scale, you can specify that higher value cells have a green color, middle value cells have a yellow color, and lower value cells have a red color. You can specify the value type, value, and color for the minimum, middle, and maximum properties.
The following image uses the three color rule:
Set the properties of the TwoColorScaleConditionalFormattingRule class or the ThreeColorScaleConditionalFormattingRule class and then apply the formatting.
This example code creates a three color rule and uses the SetConditionalFormatting method to apply the rule.
C# |
Copy Code
|
---|---|
protected void Page_Load(object sender, System.EventArgs e) protected void Button1_Click(object sender, EventArgs e) |
VB |
Copy Code
|
---|---|
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click |