+ Reply to Thread
Results 1 to 8 of 8

Possible to conditional format fill color of pivot chart bars?

  1. #1
    Registered User
    Join Date
    02-27-2007
    Posts
    38

    Possible to conditional format fill color of pivot chart bars?

    Hi All,

    Is there a way to condition the fill formatting of bars in a bar type pivot chart on the values of one of the columns in the pivot table? Here's some screenshots illustrating what I'd like to do:

    example1.jpg
    example2.jpg

    I manually clicked on each bar and changed the formatting to red for this example. In my actual work, the "category 1" column has many many values so I'd rather not have to do that, especially since that formatting is reset with some changes to the pivot table.

    Is there a built in excel setting I can use to do this? Is it possible to do with VBA? I don't need the color choice to be made automatically, I just want to avoid having to click into every bar to set the fill color. So I'd be fine making a table of all of the valid values of category 1 and the color choice I want for each if I could somehow have that automatically translate over to the pivot chart.

    Any ideas on the best way to accomplish this?

    Thanks,

    Dave
    Last edited by DaveF; 10-30-2013 at 08:42 PM. Reason: add solved prefix

  2. #2
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Possible to conditional format fill color of pivot chart bars?

    You would need to:
    Step 1. Seperate your values into seperate columns
    Step 2. Set column overlap to 100%

    Because this is a pivot table, this becomes more difficult.

    You could.... add two columns to your original data table called A-Value & B-Value. then have =if([category1]="A",[VALUE],"") in the first column, and =if([category1]="B",[Value],"") in the second column.

    If that is not clear, I would suggest upload the workbook, rather than an image file. It is easier for people to take the excel file, and construct a solution for you. I am confident the suggestion above will work, but because you uploaded image files, I am unable to test it.
    Please click the * icon below if I have helped.

  3. #3
    Registered User
    Join Date
    02-27-2007
    Posts
    38

    Re: Possible to conditional format fill color of pivot chart bars?

    Thanks for the help.

    Here's an example workbook.

    I tried creating the separate columns, and it handled the colors, but then I lose the ability to get them to sort correctly (I changed the numbers in the original table to illustrate this). I'd like for it to sort the category 3 values within each cat2/cat1 grouping. I.e. sort in the way it would if I used the original single value column instead of the two created separate columns and had the pivot table sorted on that value column.

    pivot chart example - Copy.xlsb

  4. #4
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Possible to conditional format fill color of pivot chart bars?

    Can you take the latest version you uploaded, and create a version showing how you would want it sorted, using the "Value" field? The formatting won't be correct, but I am not sure of what you are envisioning in terms of how this would be sorted.

  5. #5
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Possible to conditional format fill color of pivot chart bars?

    Perhaps this is what you mean. If not, you should be able to sort by the values column and get what you are looking for, I am guessing.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-27-2007
    Posts
    38

    Re: Possible to conditional format fill color of pivot chart bars?

    They chart you were showing sorted things the way I wanted.

    What did you do to get it so that "Value" doesn't appear in the pivot chart?

    Also, do you know if it's possible to do that without having the value column in the sum area of the pivot table? (or even better, having just value in the pivot table, and leaving "sum of B" and "sum of C" columns out.

    I'd like to have the table showing Category 1, Category 2, Category 3, Value, and the chart showing the same, but with the bars sorted by value and colored according to category 1.

    Thanks for the help with this!

  7. #7
    Registered User
    Join Date
    02-27-2007
    Posts
    38

    Re: Possible to conditional format fill color of pivot chart bars?

    I think I have it now. That's what the setting of overlap did. I missed that in the first reply. I think I can add that series, set the overlap to 100%, then hide columns for A and B in the pivot table. That gets things where I need. Thank you for the help!

  8. #8
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Possible to conditional format fill color of pivot chart bars?

    It is definitely a roundabout way, but sometimes that is what you needs to do with pivot tables.
    I believe you HAVE to have the value column included, and it needs to be first in the pivot table because of the overlap priority.
    Thanks for the feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 09-26-2012, 01:08 PM
  2. Change chart color bars VBA code assistance
    By BGiffin2004 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-14-2011, 01:14 PM
  3. how to change color of bars in bar chart based on 2nd variable
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-30-2010, 09:49 AM
  4. How do I fill the up/down bars areas with solid color
    By Seaborn in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-28-2007, 05:59 PM
  5. Custom fill color scheme & conditional format
    By tian0020 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2007, 02:31 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1