Q: Conditional value of data bars in excel I have a pivot table with 2 columns "total time" and "Year". I have selected all "totaltime" values and right clicked - quick analysis - data bars. Then all bars are by default blue. How can I apply a conditional color of the bars depending on the value? Lets say show as red if value is below 500?

A: Setup conditional formatting in a third column that sets the fill color based on the value of 'total time'. Loop through the VBA below to set the data bar color equal to the color in the conditional formatting column.
Dim intCount As Integer

On Error Resume Next
For intCount = 9 To 43 'rows with data bars
    Worksheets("Worksheet Name").Cells(intCount, 10).FormatConditions(1).BarColor.Color = Worksheets("Worksheet Name").Cells(intCount, 11).DisplayFormat.Interior.Color 
'this will update data bars in column J (10) based on column K adjust accordingly
Next intCount

