Change graphic chart color bar based on name?

Jimic

New Member
Joined
Jul 16, 2009
Messages
6
Hello to all!
I have a horizontal graphic chart showing Intel and AMD processors speeds. I was wondering if it is possible to tell Excel to apply a color to Intel processors bar and another to AMD ones?
Thanks a lot for any help.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Yes. Exactly how depends on the details of your chart. My best guess is that you have all the data in one series when it should be two. Try this: Right click on chart and select Source Data. Where it says "Series in:" change from Columns to Rows, or vice versa.
 
Last edited:
Upvote 0
Thank for your atention Phox.
I have all data in one series, i did what you said but it assings a diferent color to each category. I want just two colors, Intel and AMD.
 
Upvote 0
The easiest way might be...well, depends on how many data points you have.

If just a few, change those that belong to one of the companies to the desired color. First click on the series to select it. Then, click on a data point. This will select the data point by itself. Right-click and select Format Data Point...and set the marker/fill color as desired. Repeat for each of the other data points.

If a lot, put the data for the 2 series in 2 columns and plot them as two series. Format the 2 series as desired.

Thank for your atention Phox.
I have all data in one series, i did what you said but it assings a diferent color to each category. I want just two colors, Intel and AMD.
 
Upvote 0
Just two collums. Processors and Speed Values.
For example:

Intel Core 2 - - -- - - 24
Intel Quad - - - - - - - 45
AMD Phenom - - - - - - 86
Intel Dual - -- - - - - - 104
AMD Opteron - - - - - - - 130
 
Upvote 0
I tried to do what tusharm said. One series for intel, other for AMD. It works for the colors, but the graphic is not what i wanted.
It display the less value from Intel and below the less value for AMD and so forth, one series and then the other one. I want the values to be decreasing, no matter what series is. Was i clear?
Thanks
 
Upvote 0
Sorry about the cross post guys, didn´t know that rule. Sorry.
I´ll stay here because you guys are helping me.
Thanks a lot.
 
Last edited:
Upvote 0
Try this macro, you may need to change a couple things depending on how many charts there are, series, etc.

Code:
Sub ChangeBarColors()
    
    Dim i As Long
    Dim YLabels() As Variant
    
    With ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)
        YLabels = .XValues
        For i = LBound(YLabels) To UBound(YLabels)
            If Left(YLabels(i), 3) = "AMD" Then
                .Points(i).Interior.ColorIndex = 3
            Else
                .Points(i).Interior.ColorIndex = 5
            End If
        Next i
    End With
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,395
Members
449,446
Latest member
CodeCybear

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