Recently, Paul, a reader, of the Chandoo Blog Post: Colors-in-excel-chart-labels-trick asked a question:
“Hi Chandoo,
Is it possible to change the background label color on chart depending on the value? ”
I answered with a general “Yes” and offered two solutions
1. Using CF to color the background cells behind the chart
2. A VBA Solution to change the chart colors
This post will examine how to implement each method:
I have attached sample files which includes both examples Excel 2007-13 Sample or Excel 97-2003 Sample
You can follow along in this file before attempting it on your own data.
Using Conditional Formatting to Color the background cells
In the sample file goto the CF Technique worksheet
In CF Technique worksheet you will see a set of data with dates and Scores for each date
Below the main table is a calculation of the slope of the line of best fit through the data
This shows either a positive number when the data is trending upwards or a negative number when it is trending downwards
For the purpose of this we can simply change the yellow cell C13 from 90 to 10 to change the slope from a Positive to a Negative value
Next to the chart is a simple X-Y Chart showing the Scores vs the Date (Blue) and a Line of best fit (Dashed Red)
The chart is exactly covering the range E3:L15, this is achieved by placing the chart roughly in position and then holding the Alt Button whilst dragging the corners or edges of the chart.
Note: The use of Alt forces Excel to Snap the object onto the cell edges and lock it there, so that when the column width or row height changes, the Chart will resize with it.
Next we set the colors of the Chart Area and Plot Area to Transparent (No Color)
The Chart area is the Background area of the chart, White in the following example
The Chart area is the Background area of the chart, Yellow in the following example
We can see that the chart area has no color in the above picture as we can see the Grid Lines through the Chart Area.
Format the Chart Area
Select the Chart
Right Click in the Chart Area,
Format Chart Area

Click on the Fill Tab and set the Fill to No Fill
Format the Plot Area
With the chart selected, Right Click in the Plot Area,
Format Plot Area
Click on the Fill Tab and set the Fill to No Fill
Click outside the chart
Apply a Conditional Formatting to the Range behind the Chart
Select the range E3:L15 (You won’t be able to use a mouse) or drag the chart out of the way first.
Goto Conditional Formatting Tab
New Rule
Use a formula to determine which cells to format
Enter the formula: =$C$15>0
Select the Format Button and select a Light Redish Color
Ok
Goto Conditional Formatting Tab
New Rule
Use a formula to determine which cells to format
Enter the formula: =$C$15<=0
Select the Format Button and select a Light Greenish Color
Ok
Now change the value of C15 from 90 to 10
The chart should change as per the below image:
Advantages:
- Doesn’t require VBA (VBA not permitted on some corporate systems)
- Simple to setup for those unfamiliar with VBA
Disadvantages:
- The Chart is locked to the cells and can’t be moved moved independently of the background cells
- More difficult to implement multiple color scenarios
- Harder to permit independent changes to the Chart and Plot areas
Using VBA to directly change the color of the Chart Chart Area
In the sample file goto the VBA Technique worksheet
You will see the same set of data with dates and Scores for each date
Select the Chart and notice that the Chart is called “Chart 1”
Goto VBA, Press Alt+F11
Double click on the VBA Technique code module
Copy and paste the following code into the module
Private Sub Worksheet_Calculate()
Dim myColor As Long
Dim myChart As String
Application.EnableEvents = False
If ActiveSheet.Name <> "VBA Technique" Then Exit Sub
myChart = "Chart 1"
If [c15] <> [OldSlope] Then
If [c15] > 0 Then
myColor = RGB(250, 190, 145) 'Apricot
Else
myColor = RGB(135, 235, 145) 'Pale Green
End If
ActiveSheet.ChartObjects(myChart).Activate
' Color the Chart Area
With ActiveSheet.Shapes(myChart).Fill
.Visible = msoTrue
.ForeColor.RGB = myColor
.Transparency = 0
.Solid
End With
' Color the Plot Area
ActiveChart.PlotArea.Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = myColor
.Transparency = 0
.Solid
End With
ActiveWorkbook.Names.Add Name:="OldSlope", RefersToR1C1:="=" + CStr(Cells(15, 3).Value)
End If
Application.EnableEvents = True
Range("C17").Select
End Sub
Return to the Excel worksheet
Now change the value of C15 from 90 to 10
If the Chart area doesn’t change color follow the following few steps
Goto VBA (Alt+F11)
Open the Immediate window (Ctrl+G)
Type in Application.EnableEvents = True press enter
Go back to Excel (Alt+F11)
Advantages:
- Allows the Chart to be moved independently of the background cells
- Allows a much simpler implementation of multiple color scenarios
- Allows independent changes to the Chart and Plot areas as well as other Chart Elements
Disadvantages:
- Requires VBA (not permitted on some corporate systems)
Other Chart Conditional Formatting Posts
You may also be interested in the following Chart Formatting posts:
http://chandoo.org/wp/2011/08/19/selective-chart-axis-formating/
http://chandoo.org/wp/2011/08/22/custom-chart-axis-formating-part-2/
Closing
What do you think of these techniques?
Let us know in the comments below.


























31 Responses to “Beautiful Budget vs. Actual chart to make your boss love you”
Would be considerably easier just to have a table with the variance shown.
On Step 3, how do you "Add budget and actual values to the chart again"?
There are a few ways to do it.
Easy:
1) Copy just the numbers from both columns (Select, CTRL+C)
2) Select the chart and hit CTRL+V to paste. This adds them to chart.
Traditional:
1) Right click on chart and go to "select data..."
2) From the dialog, click on "Add" button and add one series at a time.
One more way to accomplish it is just select the columns into chart. Press Ctrl+C and then press Ctrl+V
Regards
Neeraj Kumar Agarwal
Unfortunately, this doesn't seem to work for me in Excel 2010. The "Var 1" and "Var 2" columns cannot combine two fonts to display the symbol and the figure side-by-side.
Secondly, there is no option to Click on “Value from cells” option when formatting the label options. The only options provided are Series Name, Category Name or Value.
@TheQ47... the emoji font also has normal English letters, so if you use that font, then you should be ok. I am assuming your computer doesn't have that font or hasn't been upgraded for emoji support.
Reg. Excel 2010, you can manually link each label to a cell value. Just select one label at a time (click on labels, wait a second, click on an individual label) and press = and link it to the label var 1 or var 2.
I am using excel 2010, please explain how to apply Step 12
Regards
Neeraj Kumar Agarwal
Hi Neeraj,
"Value from cells" option is only available in Excel 2013 or above. In older versions, you have to manually adjust the label value by linking each label seperately.
Read this please: https://chandoo.org/wp/change-data-labels-in-charts/
Sir, you are just awesome.
Your creativity has no limit.
Regards
Neeraj Kumar Agarwal
Hi Chandoo,
I just found your website, and really love it. It helps me a lot to be an Excel expert 😉
Currently I am facing with a problem at step 11:
Var1 Var2
D30%
A5%
B0%
B4%
B7%
C10%
C13%
D27%
I42%
Though at mapping table, I used windings, here formula uses calibra. How I can change it? I am able to change only the whole cell. In this case numbers will be Windings too.
Thanks for your help!
Hi Mariann... Welcome to Chandoo.org and thanks for your comment.
If you wanted to use symbols from wingdings and combine them with % numbers, then you need to setup two labels. One with symbol, in wingdings font and another with value in normal font. Just add the same series again to the chart, make it invisible, add labels. You may need to adjust the alignment / position of label so everything is visible.
[…] firs article explains how you can enhance your charts with symbols. You can simply insert any supported symbol into your data and charts. To some extend you can […]
You're a good person, thank you to share your knowledge with us, I will try to do in my work
Great visualization of variance. My question is that is this possible in powerbi?
How would you go about it?
HELLO, WHY CANT I FIND VALUES FOR LABELS IN EXCEL 2013
Dear chanddo sir,
What to do if we have dynamic range for Chart. How this will work. can you able to make the same thing works on dynamic range.
Sir Chandoo,
Good Day!
First, I'd like to say that I am very grateful for your work and for sharing all these things with us.
I tried to do this chart but it seems that the symbols don't work with text (abs(var%),"0%") unless we keep the Windings font style.
The problem is, it converts the text into symbol as well and you wont see the 0% anymore. I'm using Windows 7.
WOW - Segoe UI Emoji
This is the greatest discovery for me this month 🙂 Thanks for sharing.
Here's my two-cents:
https://wmfexcel.com/2019/02/17/a-compelling-chart-in-three-minutes/
Sir This is awesome chart, and very easy to made because of your way to explain is very simple , everyone can do. Thank you
one problem i am facing, I hv made this chart , but when i am inserting data table to chart it is showing two times , how can i resolve this
in this chart when i am adding new month data for example first i made this chart jan to mar but when i add data for the apr month graphs updated automatically but labels are missing for that new month
Hi Renuka,
Please make sure the formulas for labels are also calculated for extra months. Just drag down the series and set label range to appropriate address.
So I am playing with the Actual chart here - but amounts are bigger than your - you have 600 as Budget - my budget is 104,000 - is there a way to shorten that I am unaware of
thank you - I LOVE YOUR SITE
Thanks for the tips and tricks on Excel. In the Planned versus Actual chart examples, you use multiple values (ex. multiple Categories in above). How can this be done when we have only 1 set of values? For example if I have only this:
Planned Actual
SOW Budget 417480 367551
How can I create a single bar chart like the one above?
Thank you Chandoo.
This one is just perfect for my Quarterly Review presentation on Operational Budget against Actual Performance for the Hospital I'm currently working with.
Just Subscribed today (10 minutes ago)
Is there a way to make the table of data into a pivot table to be able to add a slicer for the graph due to many different categories and months?
Hi, I tried to modify you template with something appropriate for me, and I found a problem. this template was modified by me started with excel 2010, then 2016 and finally 2019. Same thing - somehow appear an error - or didn't show the emoticons for positive percentage or doubled the emoticons for some rows. I suspect to be from excel. if is need it I can sand you my xlsx for study. Please help if you can.
Hi Chandoo,
Could you please check the Var Formula in Step1. You have mentioned budget-actual and when i did this i got different values but when reversed like actual-budget i got the actual value what you have demonstrated in step1.
Please share your view.
This is a great chart (budget vs. actual). However, in trying recreate it, I cannot color in the UP Down bars individually, and they all become formatted with the same color. I'm using Office 365. Look forward to the feedback.
Thanks.
Dan
pls explain in detail step 7
While in the Excel sheet you have used following formula for Var
Var = Actual - Budget
But
in the note, you have written
Var = Budget - Actual
Good Presentation and Data information.thank you so much chandoo.