Reputation: 27
I've got a table like below:
And chart made from this table:
Now i would like to format the color of bars in this chart based on whether the value is >=100% (then green color) or <100%.
Is there any way to do it?
Thanks in advance :)
Upvotes: 0
Views: 116
Reputation: 7891
You could use VBA to reformat the bars, based on the values:
Sub BarChartConditionalFormat()
Dim ser As Series
Dim v() As Variant
Dim i As Integer
With ActiveSheet.ChartObjects("Chart 1").Chart
For Each ser In .SeriesCollection
v = ser.Values
For i = LBound(v) To UBound(v)
If v(i) >= 1 Then
ser.Points(i).Format.Fill.ForeColor.RGB = RGB(0, 255, 0)
Else
ser.Points(i).Format.Fill.ForeColor.RGB = ser.Format.Fill.ForeColor
End If
Next i
Next ser
End With
End Sub
Upvotes: 1