Excel conditional formatting Color Scales

This tutorial will teach you how to conditionally format cells in Excel using gradient color scales to visually compare values in a range.

Excel conditional formatting is all about visualizing data with colors. You can use contrasting colors to represent data categories or gradients to "map" data with some intrinsic order. When a certain pallet is used to visually represent data, it becomes a color scale.

Color scales in Excel

A color scale is a sequence of smoothly changing colors that represent smaller and larger values. They come in especially handy to visualize relationships between numerical values in large datasets.

A typical example is heat maps that are widely used by analysts for discovering generic patterns and trends in various data types such as air temperatures, stock quotes, incomes, and so on.

There exist three main types of color scales:

  • Sequential - gradients of the same hue going from light to dark or the other way round. They are best suited for visualizing numbers that go from low to high. For example, a medium green color says: "this value is a bit higher than the light green but lower than the dark green".
  • Diverging, aka bipolar or double-ended - they can be thought of as two opposite facing sequential color schemes combined together. Diverging shades reveal more differences in values than sequential colors. They are perfect for visualizing frequencies, priorities, perceptions, or behavioral changes (e.g. never, rarely, sometimes, often, always).
  • Qualitative or categorical - these are a few different colors such as red, blue, green, etc. They work nice for representing data categories that have no inherent order like industries, territories, species, etc.

Microsoft Excel has a number of preset 2-color or 3-color scales, which can be customized to your liking. Also, you can create a custom scale with a palette of your choosing. Excel color scale

How to add color scale in Excel

To add a color scale to your worksheet, follow these steps:

  1. Select a range of cells that you want to format.
  2. On the Home tab, in the Styles group, click Conditional Formatting.
  3. Point to Color Scales and choose the type you want. Done!

For example, here's how you can use a 3-color scale (red-white-blue) to "map" air temperatures: Add color scale in Excel.

By default, for 3-color scales, Excel uses the 50th percentile, also known as median or midpoint. The median divides the dataset into two equal parts. Half of the values lie above the median and half are below the median. In our case, the cell that holds the median is colored white, the cell with the maximum value is highlighted in red, and the cell with the minimum value is highlighted in dark blue. All other cells are colored proportionally in different shades of those three main colors.

The default behavior can be changed by editing a preset color scale or creating your own one:

To modify an existing color scale, select any of the formatted cells, click Conditional Formatting > Manage Rule > Edit, and then choose different colors and other options. For more details, see How to edit conditional formatting rules.

To set up a custom color scale, please follow the below example.

How to make custom color scale in Excel

If none of the predefined scales suits your needs, you can create a custom scale in this way:

  1. Select the cells to be formatted.
  2. Click Conditional Formatting > Color Scales > More Rules. Create a custom color scale in Excel.
  3. In the New Formatting Rule dialog box, configure these options:
    • In the Format Style dropdown box, select either 2-Color Scale (default) or 3-Color Scale.
    • For Minimum, Midpoint and Maximum values, pick the data type (Number, Percent, Percentile, or Formula), and then choose the color.
  4. When done, click OK.

Below is an example of a custom 3-color scale based on percentage:

Minimum is set to 10%. This will color the bottom 10% values in the darkest shade of the color you chose for the minimum value (lilac in this example).

Maximum is set to 90%. This will highlight the top 10% values in the darkest shade of the color chosen for the minimum value (amber in our case).

Midpoint is left default (50th percentile), so the cell containing the median is colored white. Custom 3-color scale based on percentage

Excel color scale formula

In Microsoft Excel, you would typically use the MIN function to get the lowest value in the dataset, MAX to find the highest value, and MEDIAN to get the midpoint. In conditional formatting color scales, it makes no sense to use these functions as the corresponding values are available in Type dropdown boxes, so you can simply pick them. In some situations, however, you may want to define the threshold values in a different way using other formulas.

In the below example, we have average temperatures for two years in columns B and C. In column D, the percent change formula returns the difference between the values in each row:

=C3/B3 - 1

The differences are conditionally formatted using a 2-color scale based on these formulas:

For Minimum, the SMALL function returns the 3rd smallest value. As a result, the bottom 3 numbers are highlighted in the same shade of beige.

=SMALL($D$3:$D$16, 3)

For Maximum, the LARGE function brings the 3rd highest value. As a result, the top 3 numbers are colored in the same shade of red.

=LARGE($D$3:$D$16, 3) Excel color scale formulas

In a similar manner, you can do conditional formatting with 3-color scale formulas.

How to create 4-color scale and 5-color scale in Excel

Conditional formatting in Excel only provides 2-color and 3-color scales. No preset rules for multi-color scales are available.

To emulate 4-color or 5-color scale, you can create a few separate rules with formulas, one rule per color. Please note, the cells will be formatted with the distinct colors of your choosing and not gradient colors.

Here are the detailed instructions to set up a conditional formatting rule with formula. And here are formula examples to mimic a 5-color scale:

Rule 1 (dark blue): lower than -2

=B3<-2

Rule 2 (light blue): between -2 and 0 inclusive

=AND(B3>=-2, B3<=0)

Rule 3 (white): between 0 and 5 exclusive

=AND(B3>0, B3<5)

Rule 4 (light orange): between 5 and 20 inclusive

=AND(B3>=5, B3<=20)

Rule 5 (dark orange): higher than 20

=B3>20

The result looks pretty nice, isn't it? 5-color scale in Excel

How to show only color scale without values

For color scales, Excel does not provide the Show Scale Only option like it does for Icon Sets and Data Bars. But you can easily hide numbers by applying a special custom number format. The steps are:

  1. In your conditionally formatted data set, select the values you want to hide.
  2. Press Ctrl + 1 to open the Format Cells dialog box.
  3. In the Format Cells dialog box, go to the Number tab > Custom, type 3 semicolons (;;;) in the Type box, and click OK.

That's all there is to it! Now, Excel shows only the color scale and hides the numbers: Show a color scale without numbers.

This is how to add color scales in Excel to visualize data. I thank you for reading and hope to see you on our blog next week!

Practice workbook for download

Using color scales in Excel - examples (.xlsx file)

7 comments

  1. I needed help on how to apply colour shades to four variables in a cell like Orange, Green, Yellow and Red for BMI results of Underweight, Normal, Overweight and Obese respectively. Your worksheet on the addirion of five colour scheme above did not show the step by step process to add the colours. You just showed an excel sheet showing the five colours but failed to show how you applied these colours as you showed for the two or three colour scheme that's the default setting in the ''Conditional Formatting'' on the excel page. It was actually not helpful in any way.

  2. Hello and thanks for the guide. In my application I now have a list of the ratio between travel times by train and by car. I'd like to find out the HEX colour values of each cell (like #8F430B) and make a map visualizing it. How can I accomplish that?

  3. This type of formatting only seems to format a selection of cells relative to each other.
    Is it possible to format a cell so it shows red if it is zero and green if 100, and a shade in between?
    That's without looking at any other cells though.

  4. Is there anyway to use the color scale to color the entire row based on the values in a single column?

    • You can achieve this with a custom formatting rule. In "Applies to," make sure the range of rows & columns is selected. In the rule, select "Use a formula to determine which cells to format," and use a formula which locks the column value.

      For example, let's say we want to apply formatting to the full row when the value in column C contains the text "Red," and we want to apply this formula to the range B2:D10. The formula to use would be:

      =$C2 = "Red"

      or more intuitively:

      =IF($C2 = "Red", TRUE, FALSE)

      Note that the top-left cell of the range to apply the rule to is B2, so we write the formula from the "perspective" of cell B2.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)