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
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,771
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.
 

wyeah

Board Regular
Joined
Jun 23, 2003
Messages
92
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
 

Osric Wuscfrea

New Member
Joined
Nov 22, 2012
Messages
6
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
 

Watch MrExcel Video

Forum statistics

Threads
1,095,156
Messages
5,442,699
Members
405,192
Latest member
Jesse McCarron

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top