+ Reply to Thread
Results 1 to 22 of 22

Conditional Formats in Charts

  1. #1
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Conditional Formats in Charts

    I am trying to create a chart in excel which automatically updates from green to red and vice versa.

    I have attached a copy of my work, its self-explanatory.

    But here is what I am after:

    Cells B32, 33 and Cells C32, 33 are conditionally formatted.

    Conditions:

    If the expense is greater than the income then = RED

    If expense is less than income then = GREEN

    This is still in its phase 1 so if anyone has ideas on how to improve this then that would be great.

    Thank You in advance
    Attached Files Attached Files
    Last edited by Jazzy Max; 09-27-2009 at 07:43 PM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Conditional Formats in Charts

    Hi,
    there are solutions at Jon Peltier's site

  3. #3
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    I cant seem to apply that to these charts..

    Any solution at all?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    Don't use the 3d style of charts. You will have to use code otherwise.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    Hi Andy,

    Thank you for replying.

    Would it be possible for you to show me the starting script(s) to the macro?

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    very nice sir...very nice! thank you so much for your help Andy

  8. #8
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Conditional Formats in Charts

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  9. #9
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    Hi Andy, thank you for your help so far, I really appreciate it.

    I have tried tweaking the macro a bit to show the expenses are red if they exceed the income...I am unable to do so for both sides?

    Any suggestions?

    thank you

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    Can you post the tweaks you have made.

  11. #11
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    Well I was trying to change the columns that go red, the switch between red and black.

    I have tried entering 'Green' where it says 'Red' (in the macro) I have tried:

    With ActiveSheet.ChartObjects(1).Chart
    ' make both bars the same
    .SeriesCollection(2).Format.Fill.ForeColor.RGB (155,0,2) = .SeriesCollection(1).Format.Fill.ForeColor.RGB (160,8,5)

    Just random colours for now, but the columns that I wanted to change weren't changing..

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    That line does not make sense.

    To set the colour of a column use
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    that is changing the colour for the Income column.

    I wanted to make the 'Expense' column (Which currently switches between Red and black) to follow the conditional format that I had set in cells B32, C32and B33, C33

    Maybe I didn't explain myself properly..sorry

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    Try this,

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    that's very good Andy, you are too good!

    but its when 'Mr A's' expenses are greater than his income, the expenses stay green...so its kind of inverted.

    Again I have tried, and that doesn't work

    This is what I am after.

    MR A Columns

    Income = $60,000
    Expense = $61,000

    Then expense column goes red.

    Income = $60,000
    Expense = $60,000 (or below)

    the expense column stays green...

    Is there a code for that?

  16. #16
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    Yes you just need to add the code to test the values the other way around.

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    Cool.

    Thanks

    I will have to play around with this a little bit. Somehow, I dont see what I want (you have done great) I need to re-do the conditions.

    I wanted it to turn out the opposite to what it is now..

    If the income is less than the expenses then both columns should be red

    If the income is more then both columns can be green...?

    Does that make sense to you, any suggestions on how I can improve this?

    Thank You

  18. #18
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    Just add another line to format the other series,

    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    Great I will be testing this out shortly.

    One last query, is it possible for these graphs to change colour automatically?

    i.e. is there a non-macro way to do this?

    Because I will want to present 2 versions, one with a macro and one without a macro...

    Andy, I really appreciate your assistance.

  20. #20
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    To do it without macros you first need to use a 2d chart style. You can use 3d but you have no control over the data label position.

    You then need to layout data out slightly differently to add padding columns.
    The column gap is set to zero to make the columns appear next to each other.
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    09-08-2009
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Conditional Formats in Charts

    Amazing! You are a genius.

    Thank you for all your efforts I now have both graphs going well and that is all thanks to you.

    How do I add you in my list? If thats ok with you.

  22. #22
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Conditional Formats in Charts

    Not sure what list you are refering to.
    Friends list maybe,
    http://www.excelforum.com/faq.php?fa...iends_contacts

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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