Contextures

Home > Format > ConditionalFormatting > Data Bars

Excel Conditional Formatting Data Bars

Use conditional formatting to add data bars to cells with numbers. This makes it easy to visually compare numbers, as you would in a bar chart.

data bars with green gradient

Data Bars Intro

If cells contain numbers, you can add conditional formatting data bars, to show the differences among the amounts. Watch this short video to see how to set up data bars in a cell, and the written instructions are below.

How to Add Data Bars 

In the screen shot below, conditional formatting data bars have been added to a sales report. You can quickly see that June had the smallest sales, and January and March have the largest.

conditional formatting data bars

To add conditional formatting with data bars, follow these steps. go to top

  • On the Excel worksheet, select the cells with numbers that you want to format. Do NOT include any row or column totals.
  • On the Ribbon, click the Home tab, and then in the Styles group, click Conditional Formatting.
  • In the list of conditional formatting options, click Data Bars, and then click one of the Data Bar options -- Gradient Fill or Solid Fill. (see tips below)

choose an option for data bars

The selected cells now show Data Bars, along with the original numbers. In this example, the Green Gradient data bar option was selected.go to top

data bars with green gradient

Data Bars Tips

Fill Type

There are two sets of Data Bar options -- Gradient Fill and Solid Fill.

  • Solid Fill is a better choice if the data bars if the numbers will be hidden in the cells (instructions below)
  • Gradient Fill is better if the numbers will be visible in the cells -- the lighter colours at the end of the gradient make it easier to read the numbers.

NOTE: Change the numbers to Bold font, so they are easier to see.

gradient fill and bold font

Column Width

If possible, make the column wider than usual, if you are adding data bars, especially if the numbers will also be visible.

  • A wider column makes it easier to see the differences among the bars
  • In a wider column, the numbers at the right will be positioned over the lighter part of a bar with gradient fill.

conditional formatting data bars

Show Data Bars Only 

After you add Data Bars, you can change the conditional formatting settings, so only the data bars are shown in the cell, without the numbers.

Follow these steps to hide the numbers:

  • Select the cells that contain the data bars.
  • On the Ribbon, click the Home tab
  • In the Styles group, click Conditional Formatting, and then click Manage Rules.
  • In the list of rules, click your Data Bar rule.
  • Click the Edit Rule button, to open the Edit Formatting Rule dialog box.
  • Click the Edit Rule button

  • In the second section -- Edit the Rule Description -- add a check mark to Show Bar Only
  • check mark for Show Bar Only

  • Click OK, twice, to close the dialog boxes.

Set Data Bar Minimum

When you add Data Bars, their minimum and maximum values are automatically set, usually with a minimum of zero, and a maximum that matches your highest value.

To "zoom in" on the differences between the amounts, follow these steps to change the Minimum setting:

  • Select the cells that contain the data bars.
  • On the Ribbon, click the Home tab
  • In the Styles group, click Conditional Formating, and then click Manage Rules.
  • In the list of rules, click your Data Bar rule, then click the Edit Rule button
  • In the "Edit the Rule Description" section, the default settings are shown for Minimum and Maximum
  • Click the arrow for Type, under Minimum, to see the other options.
  • data bar minimum type options

  • For this example, select Formula
  • Then, in the value box, type the following formula.

      =MIN($G$4:$G$9)*0.9

      The formula finds the lowest value in the group of cells, and sets the minimum 10% below that. (If you just choose Lowest Value, there is no bar visible for that value, which can be confusing).

  • (optional) Change the Maximum settings, if required. (see note below)
  • Click OK, twice, to close the dialog boxes.

NOTE: In the sample file, a formula is also used to set the Maximum: =MAX($G$4:$G$9)*1.1. That formula finds the highest value, and sets the maximum 10% above that. This creates a small space at the end of the bar, instead of going to the cell border. Use a similar formula if you want extra room to show numbers, without the bars overlapping them.

data bar minimum and maximum set with formulasgo to top

Get the Sample File

To follow along with this tutorial, get the Conditional Formatting Data Bars sample file. The file is in xlsx format, and does not contain macros.

Related Tutorials

  1. Conditional Formatting Introduction
  2. Conditional Formatting Based on another cell
  3. Conditional Formatting Examples
  4. Conditional Formatting Documentation  

Last updated: October 29, 2022 3:37 PM