Class IconCriterion (Excel VBA)

The class IconCriterion represents the criterion for an individual icon in an icon set. The criterion specifies the range of values and the threshold type associated with the icon in an icon set conditional formatting rule.


To use a IconCriterion class variable it first needs to be instantiated, for example

Dim lngIndex As Long: lngIndex = 
Dim isc As IconSetCondition: Set isc = 
Dim icncrtIconCriteria As IconCriterion
Set icncrtIconCriteria = isc.IconCriteria(Index:=lngIndex)

The following procedures can be used to set variables of type IconCriterion: IconSetCondition.IconCriteria and IconCriteria.Item

For Each

Here is an example of processing the IconCriterion items in a collection.

Dim isc As IconSetCondition: Set isc = 
Dim icncrtIconCriteria As IconCriterion
For Each icncrtIconCriteria In isc.IconCriteria
Next icncrtIconCriteria


Returns a Long value that specifies the number of criteria for an icon set conditional formatting rule.

The number of criteria is equivalent to the number of threshold values assigned for an icon set.


Returns a single IconCriterion object from the IconCriteria collection.

The value of the Index parameter cannot be greater than the number of criteria set for an icon set conditional format. The criteria are equivalent to the threshold values assigned for an icon set. To find the number of threshold values, use the Count property.

Syntax : expression.Item (Index)

Index: The index number of the IconCriterion object.


Returns or specifies the icon for a criterion in an icon set conditional formatting rule.

Possible Values are xlIcon0Bars - Signal Meter With No Filled Bars, xlIcon0FilledBoxes - 0 Filled Boxes, xlIcon1Bar - Signal Meter With One Filled Bar, xlIcon1FilledBox - 1 Filled Boxes, xlIcon2Bars - Signal Meter With Two Filled Bars, xlIcon2FilledBoxes - 2 Filled Boxes, xlIcon3Bars - Signal Meter With Three Filled Bars, xlIcon3FilledBoxes - 3 Filled Boxes, xlIcon4Bars - Signal Meter With Four Filled Bars, xlIcon4FilledBoxes - 4 Filled Boxes, xlIconBlackCircle - Black Circle, xlIconBlackCircleWithBorder - Black Circle With Border, xlIconCircleWithOneWhiteQuarter - Circle With One White Quarter, xlIconCircleWithThreeWhiteQuarters - Circle With Three White Quarters, xlIconCircleWithTwoWhiteQuarters - Circle With Two White Quarters, xlIconGoldStar - Gold Star, xlIconGrayCircle - Gray Circle, xlIconGrayDownArrow - Gray Down Arrow, xlIconGrayDownInclineArrow - Gray Down Incline Arrow, xlIconGraySideArrow - Gray Side Arrow, xlIconGrayUpArrow - Gray Up Arrow, xlIconGrayUpInclineArrow - Gray Up Incline Arrow, xlIconGreenCheck - Green Check, xlIconGreenCheckSymbol - Green Check Symbol, xlIconGreenCircle - Green Circle, xlIconGreenFlag - Green Flag, xlIconGreenTrafficLight - Green Traffic Light, xlIconGreenUpArrow - Green Up Arrow, xlIconGreenUpTriangle - Green Up Triangle, xlIconHalfGoldStar - Half Gold Star, xlIconNoCellIcon - No Cell Icon, xlIconPinkCircle - Pink Circle, xlIconRedCircle - Red Circle, xlIconRedCircleWithBorder - Red Circle With Border, xlIconRedCross - Red Cross, xlIconRedCrossSymbol - Red Cross Symbol, xlIconRedDiamond - Red Diamond, xlIconRedDownArrow - Red Down Arrow, xlIconRedDownTriangle - Red Down Triangle, xlIconRedFlag - Red Flag, xlIconRedTrafficLight - Red Traffic Light, xlIconSilverStar - Silver Star, xlIconWhiteCircleAllWhiteQuarters - White Circle (All White Quarters), xlIconYellowCircle - Yellow Circle, xlIconYellowDash - Yellow Dash, xlIconYellowDownInclineArrow - Yellow Down Incline Arrow, xlIconYellowExclamation - Yellow Exclamation, xlIconYellowExclamationSymbol - Yellow Exclamation Symbol, xlIconYellowFlag - Yellow Flag, xlIconYellowSideArrow - Yellow Side Arrow, xlIconYellowTrafficLight - Yellow Traffic Light, xlIconYellowTriangle - Yellow Triangle, xlIconYellowUpInclineArrow - Yellow Up Incline Arrow.

After you set the Icon property for the icon criterion in an icon set conditional formatting rule, the IconSet property of the IconSetCondition object is changed to xlCustomSet.

With Selection.FormatConditions(1) 
 .ReverseOrder = False 
 .ShowIconOnly = False 
 .IconSet = ActiveWorkbook.IconSets(xl4Arrows) 
End With 
With Selection.FormatConditions(1).IconCriteria(1) 
 .Icon = xlIconRedCross 
End With 
With Selection.FormatConditions(1).IconCriteria(2) 
 .Type = xlConditionValuePercent 
 .Value = 25 
 .Operator = 7 
End With 
With Selection.FormatConditions(1).IconCriteria(3) 
 .Type = xlConditionValuePercent 
 .Value = 50 
 .Operator = 7 
 .Icon = xlIconYellowTrafficLight 
End With 
With Selection.FormatConditions(1).IconCriteria(4) 
 .Type = xlConditionValuePercent 
 .Value = 75 
 .Operator = 7 
End With


Returns a Long value indicating which threshold the criteria represents.

For an icon set, this property will return a value of 1 for the minimum threshold, 2 for the next threshold, and so on.


Returns or sets one of the constants of the XlFormatConditionOperator enumeration, which specifies if the threshold is "greater than" or "greater than or equal to" the threshold value.

For an icon set conditional formatting rule, this property can be set to only one of the following two constants: xlGreater or xlGreaterEqual.


Returns one of the constants of the XlConditionValueTypes enumeration, which specifies how the threshold value for an icon set is determined.

Possible Values are xlConditionValueAutomaticMax - The longest data bar is proportional to the maximum value in the range, xlConditionValueAutomaticMin - The shortest data bar is proportional to the minimum value in the range, xlConditionValueFormula - Formula is used, xlConditionValueHighestValue - Highest value from the list of values, xlConditionValueLowestValue - Lowest value from the list of values, xlConditionValueNone - No conditional value, xlConditionValueNumber - Number is used, xlConditionValuePercent - Percentage is used, xlConditionValuePercentile - Percentile is used.

The type of threshold value for an icon set can be a number, percent, formula, or percentile. Setting the type to percentile will use the Percentile function in Excel to determine the threshold value.


Returns or sets the threshold value for an icon in a conditional format. Read/write Variant.

You can set the value only if the Type property for the conditional format is set to one of the following XlConditionValueTypes constants: xlConditionValueNumber, xlConditionValuePercent, xlConditionValuePercentile, or xlConditionValueFormula. If the type of threshold is a formula, you can set the formula as a String. The formula must return a single number.