# Icon Sets Rule

Learn how to display the icons based on the values entered in the cells using the icon sets rule in conditional formatting.

## Content





The icon sets rule in conditional formatting displays the icons on the basis of values entered in the cells. Each value represents a distinct icon that appears in a cell if it matches the icon sets rule applied on it. This rule can be added using the methods of the [IIconSetCondition](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IIconSetCondition.html) interface.

Refer to the following example code to add icon sets rule in a worksheet.

```Java
// Adding Icon Sets Rule
IIconSetCondition condition = worksheet.getRange("A1:A5").getFormatConditions().addIconSetCondition();
condition.setIconSet(workbook.getIconSets().get(IconSetType.Icon3Symbols));
condition.getIconCriteria().get(1).setOperator(FormatConditionOperator.GreaterEqual);
condition.getIconCriteria().get(1).setValue(50);
condition.getIconCriteria().get(1).setType(ConditionValueTypes.Percent);
condition.getIconCriteria().get(2).setOperator(FormatConditionOperator.GreaterEqual);
condition.getIconCriteria().get(2).setValue(70);
condition.getIconCriteria().get(2).setType(ConditionValueTypes.Percent);

worksheet.getRange("A1").setValue(1);
worksheet.getRange("A2").setValue(2);
worksheet.getRange("A3").setValue(3);
worksheet.getRange("A4").setValue(4);
worksheet.getRange("A5").setValue(5);
```