Excel Bar Graph Color with Conditional Formatting – 3 Examples

This is the sample dataset that you want to convert to a bar graph.

Students' Marks to Customize Excel Bar Graph Color with Conditional Formatting


Example 1. Changing the Excel Bar Graph Color by Applying a Set of Conditions

Steps:

  • Create 3 columns named Bad, Medium, and Good to insert the marks.
  • Select D5 and enter the following formula.
  • Press Enter.
=IF(C5<60,C5,"")

Find Bad Marks to Customize Excel Bar Graph Color with Conditional Formatting

  • Place your cursor at the bottom right corner of your cell and drag down the fill handle.

Drag Fill Handle to Copy Same Formula

The formula will be copied to all the cells below, and marks lower than 60 will be shown in this column.

Al Bad Marks in a Single Column

  • Select E5 and enter the following formula.
  • Press Enter.
=IF(AND(C5>=60,C5<80),C5,"")

Find the Medium Marks to Customize Bar Graph Color with Conditional Formatting

Formula Breakdown:

=IF(AND(C5>=60,C5<80),C5,””) checks if the value of C5 is less than 80, but greater than or equal to 60. If the test is true, it returns the value of C5. Otherwise, it returns blank. Result: Blank Cell

  • Place your cursor at the bottom right corner of the cell. Drag down the fill handle to copy the formula.Drag the Fill Handle to Copy Same Formula

All the marks between 60 and 80 will be displayed in this column.

All Medium Marks in a Single Column

  • To find the good criteria, click F5  and enter the formula below.
  • Press Enter.
=IF(C5>=80,C5,"")

Find Good Marks to Customize the Excel Bar Graph Color with Conditional Formatting

  • Place your cursor at the bottom right corner of the cell and drag down the fill handle.

Drag Fill Handle to Copy Same Formula

All the good marks will be displayed in this column.

All Good Marks in the Good Column

  • Select  D5:F16 >> go to the Insert tab >> Insert Column or Bar Chart >> Clustered Bar.

Insert a Bar Chart

  • A bar chart is displayed. To format it, right-click the chart and choose Select Data… .

Select Data to Customize the Bar Chart

  • In the Select Data Source window, check 49 78 and click Remove.

Select Data Source Window

  • Click Add.

Access the Add Button to Add Data Series

  • In the Edit Series window, enter Bad in Series name:
  • In Series values enter D5:D16.
  • Click OK.

Add the Bad Criteria to Customize the Excel Bar Graph Color with Conditional Formatting

The Bad column is added as a Bar graph.One Column Added As Data Series in the Graph

  • Add two other legend entries. One for the Medium column and the other one for the Good column. Click OK.

Add Other Two Criteria to Customize Bar Graph Color with Conditional Formatting

A bar graph with three different colors is displayed.

Excel Bar Graph with All Criteria

  • Select Chart Elements.
  • Untick Axes and Gridlines.
  • Tick Data Labels.

Access Chart Elements for A Better Representation of the Graph

  • Click Chart Elements >> In the Legend option, choose rightward arrow>> Select Bottom.

Add Data Labels

  • Select any of the Good column bars and right-click it.
  • Choose Format Data Series…

Select Format Data Series to Access the Format Data Series Options

  • The Format Data Series ribbon will open.
  • Go to Series Options and choose 100% as Series Overlap, and 50% as Gap Width.

Change Series Overlap and Gap Width

  • Go to the Fill & Line group on the ribbon and choose a color for the Good column. Here, Green, Accent 6.

Choose Excel Bar Graph Color with Conditional Formatting

  • Choose a color for the Medium column bars. Here, Orange.
  • Choose a color for the Bad column bars. Here, Red.

Students’ marks are in colored bars.

Excel Bar Graph Color with Conditional Formatting

Read More: How to Change Bar Chart Color Based on Category in Excel


Example 2. Customizing the Bar Graph Color with Conditional Formatting to Display Deviation of Data

Steps:

  • To calculate the average mark, merge D5:D16.
  • Click the cell and enter the formula below.
  • Press Enter.
=ROUND(AVERAGE(C5:C16),0)

Find the Average Mark of the Students

Formula Breakdown:

=ROUND(AVERAGE(C5:C16),0) returns the average of C5:C16  and rounds it to zero decimal place. Result: 76

  • To calculate the difference between each student’s mark and the average mark, select E5 cell and enter the following formula.
  • Press Enter.
=C5-$D$5

Find the Deviations from the Average Mark to Customize the Bar Graph Color with Conditional Formatting

  • Place your cursor at the bottom right corner of the cell and drag down the fill handle.

Drag Fill Handle to Copy Formula

Deviations from the average mark will be showcased.

All Students' Marks Deviations from Average Mark

  • Select E5:E16 >> go to the Insert tab >> Insert Column or Bar Chart >> Clustered Bar.

Insert a Bar Chart with Deviations to Customize Bar Graph Color with Conditional Formatting

The bar graph will be displayed.

  • Click Chart Elements and untick all options except Data Labels.

Access the Chart Elements Tool to Get Better Visualization

  • Right-click any of the bars.
  • Choose Format Data Series…

Access the Format Data Series Options

  • On the Format Data Series ribbon, go to the Series Options group.
  • Choose 100%  in Series Overlap and 50% in Gap Width.

Change Series Overlap and Gap Width to Customize Bar Graph Color with Conditional Formatting

  • In Fill & Line, tick Invert if negative.
  • Choose Green as the first Fill Color (for a positive difference) and Red as the second Fill Color (for a negative difference).

Access Fill & Line Group to Customize the Excel Bar Graph Color with Conditional Formatting

This is the output.

Excel Bar Graph Color with Conditional Formatting

Read More: How to Color Bar Chart by Category in Excel


Method 3 – Highlighting a Maximum Value in a Bar Graph Using Excel Conditional Formatting

Steps:

  • To find the maximum mark, click D5 cell and enter the following formula.
  • Press Enter.
=IF(C5=MAX($C$5:$C$16),C5,"")

Find the Maximum Mark

Formula Breakdown:

=IF(C5=MAX($C$5:$C$16),C5,””) checks if the C5 value is the maximum in the range C5:C16. If it is true, it will return the C5 value. Otherwise, it will return blank. Result: Blank Cell

  • Place your cursor at the bottom right corner of your cell. Drag down the fill handle to copy the formula.

Drag Fill Handle to Copy Formula

The maximum mark (99) is displayed in D13.

Maximum Mark Found

  • Insert a bar graph (see Example1).
  • Right-click the bar graph and choose Select Data…

Access the Select Data Series Window of Bar Graph with All Criteria

  • In the Select Data Source window, click Add.

Select Data Source Window

  • Go to Edit Series. In Series name:,enter Maximum.
  • In Series values:, refer to D5:D16.
  • Click Ok.

Add the Maximum Data in Bar Graph

  • In the Select Data Source window, click OK.

Finalize the Bar Graph to Customize Bar Graph Color with Conditional Formatting

  • Right-click the maximum mark bar and choose Format Data Series…

Access the Format Data Series Window to Customize Bar Graph Color with Conditional Formatting

  • On the Format Data Series ribbon, go to Fill & Line.
  • Choose a color for the maximum mark in Fill Color. Here, Blue, Accent 5.

Choose Maximum Mark's Color to Customize Excel Bar Graph Color with Conditional Formatting

Conditional formatting was applied to customize the bar graph color.

Excel Bar Graph Color with Conditional Formatting

Read More: How to Sort Bar Chart in Descending Order in Excel


Download Practice Workbook

You can download the practice workbook here for free!


Related  Articles


<< Go Back to Excel Bar ChartExcel Charts | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjim Reza
Tanjim Reza

Md. Tanjim Reza Tanim, a BUET graduate in Naval Architecture & Marine Engineering, contributed over one and a half years to the ExcelDemy project. As an Excel & VBA Content Developer, he authored 100+ articles and, as Team Leader, reviewed 150+ articles. Tanim, leading research, ensures top-notch content on MS Excel features, formulas, solutions, tips, and tricks. His expertise spans Microsoft Office Suites, Automating Finance Templates, VBA, Python, and Developing Excel Applications, showcasing a multifaceted commitment to the... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo