+ Reply to Thread
Results 1 to 6 of 6

Stacked Chart - Change Bar Colors Based on Date (X-Axis)

  1. #1
    Registered User
    Join Date
    06-23-2011
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2003
    Posts
    3

    Stacked Chart - Change Bar Colors Based on Date (X-Axis)

    Hi all;

    I am wanting the colors of the bars in a stacked chart to change based on the date in the X Axis. As the current date arrives, the stacked bar needs to change to various blue shades. If the date is in the future, the stacked bar needs to be various grey shades. Can anyone suggest how this can be done? If it requires VBA could you please also include a snippet example? I have an image of what I am trying to achieve attached.

    Thanks so much for sharing your expertise!

    JL
    Attached Images Attached Images

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Stacked Chart - Change Bar Colors Based on Date (X-Axis)

    you would probably need to setup the series using a range of IF statements - so if the date changes then the range series changes and so the colour

    see example attached

    change the date in cell A2 and then copy down and you will see the colours change based on todays date
    Attached Files Attached Files
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Stacked Chart - Change Bar Colors Based on Date (X-Axis)

    Hi JL,

    Attached is a working example of what I think you're after.
    The numbers are random so it doesn't quite look like the one in your example pic, but it should give you the idea of how to accomplish it.

    Basically column A is your X-Axis labels, columns B&C are the main data. Columns E&F and G&H take that main data and using simple formulas decide which columns to put the numbers in. So if the date is in the past the numbers go into E&F, if the date is in the future the numbers go into G&H.

    The graph is then plotted from columns E to H which allows you to allocate different colour sets to past and future data.

    There are probably easier/better ways of doing this, but this method works for me so it's the one I use.

    Hopefully that all makes sense. Happy to help further if not.

    BSB.

  4. #4
    Registered User
    Join Date
    07-10-2015
    Location
    UK
    MS-Off Ver
    Pro 2003
    Posts
    2

    Re: Stacked Chart - Change Bar Colors Based on Date (X-Axis)

    Quote Originally Posted by etaf View Post
    you would probably need to setup the series using a range of IF statements - so if the date changes then the range series changes and so the colour

    see example attached

    change the date in cell A2 and then copy down and you will see the colours change based on todays date
    Its beautifully done! How do you get the colour to change? it's not a macro!

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Stacked Chart - Change Bar Colors Based on Date (X-Axis)

    No, its just a stacked graph and the colour are different series in the graph

  6. #6
    Registered User
    Join Date
    07-10-2015
    Location
    UK
    MS-Off Ver
    Pro 2003
    Posts
    2

    Re: Stacked Chart - Change Bar Colors Based on Date (X-Axis)

    figured it out: check this link: http://peltiertech.com/conditional-f...-excel-charts/

    thanks

+ 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. Stacked bar chart with stacked secondary axis markers - please help!
    By Boardlady in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-22-2013, 10:32 AM
  2. [SOLVED] Dashboard help needed. Need chart axis to change based on date ranges.
    By mcranda in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2013, 10:30 AM
  3. Replies: 1
    Last Post: 05-30-2013, 10:03 AM
  4. Set the stacked bar chart colors to automatic in Excel
    By Paul Grimshaw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-04-2012, 07:54 AM
  5. Replies: 4
    Last Post: 04-13-2011, 11:51 AM

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