Fixing bar colours based on product

Zubair

Active Member
Joined
Jul 4, 2009
Messages
304
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I have made the bar chart linked to the table and changed each bars colour based on the product colour F4:G7 and saved chart as a template.

The chart is automatically showing bars on descending order based on the sales value of the product.

The issue I am facing is, when product sales value changed the bar colour is not showing colours based on product i.e. F4:G7, else colours have been fixed based on decending order of the sales value.

Given below the XL2bb Mini Sheet and screen shot of the graphs.

View 1 is the standard I fixed bar colours and saved the template.
View 2 I am changing sales value of A from 1000 to 500 and I was expecting A colour bar to appearing with green colour whereas its showing blue and B with green.

Can anybody please help me to fix the bar colour based on product rather then sales value ?

Mr. Excel.xlsm
ABCDEFGHIJKLMNOPQRS
1VIEW 1VIEW 2
2ColourProductSalesColourProductSales
3
4A1,000A500
5B900B900
6C800C800
7D600D600
8
9
10
11TotalTotal
12Column1 Column2 Column1 Column2
13A1,000B900
14B900C800
15C800D600
16D600A500
17
18
19How to fix bar colour based on the productHow to fix bar colour based on the product
20
21
22
23
Colour fixing bar
Cell Formulas
RangeFormula
G13:H16G13=IFERROR(INDEX(G$4:G$7,MATCH(LARGE($H$4:$H$7,ROWS(G$13:G13)),$H$4:$H$7,0)),"")
P13:Q16P13=IFERROR(INDEX(P$4:P$7,MATCH(LARGE($Q$4:$Q$7,ROWS(P$13:P13)),$Q$4:$Q$7,0)),"")
 

Attachments

  • Colour by product graph.PNG
    Colour by product graph.PNG
    141.5 KB · Views: 4

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,214,798
Messages
6,121,636
Members
449,043
Latest member
farhansadik

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