Bar Chart Colors based off of value

wyeah

Board Regular
Joined
Jun 23, 2003
Messages
92
Excel 2010 Windows 7

Is there VBA code that will change the color of the bars in a bar chart based off of their value? My chart is "Chart 14" and if the value for a bar, there are 14 bars, is less than 100 I would like it to be red and greater than 100 to be green.

Thanks,
Alan
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi Alan

If the values will never change I'd change the coulours manually. With just 14 bars it would be a matter of seconds.

If the values will change and you want the colours to follow, use a stacked bar chart. Split the values in 2 series, one for the less than 100 and another for the others.
 
Upvote 0
The values change each time the spreadsheet is updated. I will try the "Stacked Bar" and see what I can figure out.
Thanks for the info
 
Upvote 0
So I have a stacked bar chart which generates a Gannt which works fine.

Using the Peltier method to separate out the values, in this instance I am trying to sort by RAG (Red, Amber, Green etc) status instead of a number which works just fine.

However I cannot seem to select ALL the data in the new table, I can select a single column only in the new one, not all. If I select all the chart breaks. The desired end state is to select the RAG and that makes the bar the matching colour.
I have no idea why I can't select more data, something I do regularly in other documents.

To be clear on the intent: the Gannt works fine, just pump in two dates, chart does the rest. What I want to do is select the RAG and then the corresponding bar matches the colour.

The spreadsheet is below and I would appreciate a steer where this is going wrong.

http://www.dead-fish.com/Files/Book1.xlsx
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top