fbpx
Search
Close this search box.

Colors in Chart Labels [Quick Tip]

Share

Facebook
Twitter
LinkedIn

This post is part of our spreadcheats series – 30 Excel and Charting Tips & Hacks aimed to make day to day spreadsheeting fun and productive.

One of the most common charts is “YoY Growth Rates of Our Superawesomekickass Product”. While not everyone may have a superawesomekickass product, most of us in fact make a YoY (Year on Year) growth rate charts for various types of data.

A simple label formatting hack can improve the effectiveness of these charts by adding color to differentiate positive vs. negative growth (or mediocre vs. sky rocketing growth rates). See this example:

Excel Chart - Colors in Data Labels - How to

You can get this effect by applying custom number formatting to the data label. It is one of my favorite tricks in excel and I have written about it in introduction to custom cell formatting in excel, number formatting in excel using custom codes, showing decimal values only when needed articles.

How you can get colors in Axis Labels

First apply data labels to your chart and now select the data labels and press ctrl+1 (aww, come on now, you are reading this blog, you should what ctrl+1 means) and go to numbers tab. Select “custom” as category and specify the formatting code like this:

custom format code for getting colors in chart labels

[blue]+0%;[red]-0%

Now, that was easy, isn’t it. But you might think, “Chandoo, what the heck the above format code is doing?”

Well, it tells excel to apply red color and add a minus symbol if the data label value is less than zero and apply blue color and add + symbol if the value is above zero. You see the custom number formatting codes have 3 parts in them, like this:

formatting for positive numbers ; formatting for negative numbers ; formatting for zero values

If you are noob (hi noob!) and lost in all these codes and square brackets, you may want to checkout our post on introduction to number formatting in excel to learn more about custom codes.

Ok, that was fun, What else you can do?

You can do much more using custom codes to format data labels. For example, a code like [Red][<0.15]0%;[Blue][>=0.15]0%; will, Oh, forget it, you can guess that. Just remember that excel allows only 3 parts in custom codes. So go nuts, but just thrice.

Like this post, I mean REALLY like it?

Awesome, You should  sign up for e-mail updates or get our full RSS Feeds so that you never miss a post.

Why you should never miss a post? Because my friend, one of the posts might help you make your product superawesomekickass.

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Excel School made me great at work.
5/5

– Brenda

Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

letter grades from test scores in Excel

How to convert test scores to letter grades in Excel?

We can use Excel’s LOOKUP function to quickly convert exam or test scores to letter grades like A+ or F. In this article, let me explain the process and necessary formulas. I will also share a technique to calculate letter grades from test scores using percentiles.

32 Responses to “Colors in Chart Labels [Quick Tip]”

  1. Sam Krysiak says:

    I've been looking for a way to include colour-coded chart labels without applying the formatting manually. Great tip!

  2. Sumit Dhar says:

    Chandoo, it is possible to format the bar colors in the chart based on the values?

    Cheers,
    Dhar

  3. derek says:

    Sumit, the trick is to use lateral thinking and create two bar series: one colour is when you want it blue and zero when you don't, and the other colour is the other way round.

  4. Chandoo says:

    @Sam: thanks
    @Sumit: as Derek suggested, the trick lies in creating multiple series and completely overlapping them so that you see color as per your need.

  5. Govert says:

    Superb tip! Thanks!

  6. Sumit Dhar says:

    Derek / Chandoo,

    Thanks for your inputs.

    Cheers,
    D.

  7. David H says:

    Chandoo,

    Can you provide an example of this:

    "@Sam: thanks
    @Sumit: as Derek suggested, the trick lies in creating multiple series and completely overlapping them so that you see color as per your need."

    Thanks!
    David

  8. Chandoo says:

    @David: Sure, I will make a note of this topic and write about it in the coming weeks 🙂

  9. [...] flashy formatting, 3d pie charts, 3d donuts and layered donuts etc. Also, whenever possible, try Using data labels, using color and if nothing works, try using other types of charts for comparison. After all, we [...]

  10. David says:

    A few weeks ago, Chandoo posted some Excel Tips and mine was one of those tips. I created a KPI spreadsheet that changed the format of numbers and the colors of the chart based on the table of data below the chart. (See original post: http://chandoo.org/wp/2009/05/11/excel-tips-by-you-1/). Maybe this would be helpful. I still want to post a blog entry on this but due to budget problems in our state, I don't have the time. Soon...

  11. Vanessa says:

    Hi Chandoo!
    Is there a way I can make the labels show white doing this? I tried [White]-0.0% but it gives me a white font with a black background... I wanted the labels to be "invisible" in case it is less than zero!

    • Chandoo says:

      @Vanessa.. you can do that by using a formatting code like 0.0%;;0% (the middle portion of the formatting code tells how negative numbers should be shown, and we are telling excel to show nothing if the number is negative)

      Also, the if you want use the WHITE color, then you need to set the label background color to transparent. This can be done by selecting labels, hitting format labels option, and then in the label background color area (from font tab) you can set the background color to be transparent (the default value is automatic or something like that...)

  12. sonato says:

    hey!
    Its very good
    when I first saw it, I said: oh but this too, I could do it easily manually
    but when I did it, I really saw the beauty that accompanies it.
    Thanks

  13. jeremy says:

    i want to setup conditional formatting on a chart label, based on a cell that is not a part of the data range. i.e. i want the 90% label on a bar chart to be bold and underlined when cell A1=1, when cell A1=0 no formatting.

    is this possible? (excel 2000)

    cheers

  14. Chandoo says:

    @Sonato: Thank you 🙂

    @Jeremy: Welcome to PHD and thanks for commenting. I am not aware of a simple way to conditionally format axis labels. You can try using some macros though. But the best thing would be use as few colors as possible. This looks both aesthetically pleasing and takes less time.

    • Nathan Miller says:

      With regard to this, I have a similar question. Is there a way to format the data label text based on a cell outside the data range for the chart? E.g. I have a scatter plot based on columns b and c (sales reps names in column a), and in column d I have a binary with whether the rep has been at the company for more or less than 3 months. Is there a way to incorporate column d into the conditional formatting?

  15. keith says:

    Hi Chandoo,

    I am making a line chart to display numbers between 0 and say 30. I have upper and lower limit lines at 4 and 10. What would be the easiest way to make numbers outside those limits display red while leaving the numbers between 4 and 10 green. I am new at this and tried entering custom functions/formulas but cant get it right.

    Thanks
    P.S. Excel 2003

  16. [...] Show colors in Chart Labels, Axis Labels > Show symbols in Chart Labels, Axis > 5 Chart Formatting Tricks > More charting tutorials [...]

  17. Jo Ann says:

    I greatly appreciate that you are sharing your considerable talent.

    Quantitative information is useful and important. Your talent in showing how non-quantitative types can more easily read visual information is invaluable. Thank you.

    I must add, that I have resisted learning excel for years. But, your friendly, bit size lessons are the best.

    Jo Ann Goldberg

  18. maddy says:

    1st - Thank you for having this awesome blog! It totally rocks.
    2nd - I've done the data labeling as mentioned here and it works, but when i use the XY Data Labeller, i cant format the labels anymore. How would i be able to format the data labels after adding the labels using XY Data Labeler?
    Thanks!!
    Maddy

  19. I REALLY like this tip.

  20. Fabio says:

    WHOA!

    Thanks!

    Greetings from Brazil!

  21. Paul says:

    Hi Chandoo,

    is it possible to change background label color on chart depending on the value?

    Thanks for help !

  22. Sandy says:

    Thanks for the great tip!!
    I would like the label to be red if 100% and blue otherwise.

    I try: [Red][1]0%;[Blue]0%
    But it got auto corrected to [Red][1\]0%;[Blue]0%
    And I didn't achieve what I need.

    How can I do it? Many thanks.

  23. Sandy says:

    Oh, the symbols in my qn get truncated.

    I would like to label red if values are less than 80% or more than 100%, blue otherwise. Thanks.

  24. Arindam says:

    Hi Chandoo,
    Ctrl+1 is not opening the dialog box for formatting for the dat label in Excel 2016.
    Do you have any work around?
    Arindam

  25. Patrick says:

    Great tip!
    Now, how do I apply a color to a label that isn’t based on the value of the plotted point? For example, in the Covid graph at https://imgur.com/a/d5xYhYU the positivity rate is shown in different colors and is an independent value to the “confirmed cases". It would suffice if the end point was in a color reflecting the positivity rate. Many Thanks!

Leave a Reply