Conditional Formatting
Conditional Formatting
Conditional formatting in Excel enables you to highlight cells with a certain color, depending on the cell's value.
5. Click OK.
Result. Excel highlights the cells that are greater than 80.
6. Change the value of cell A1 to 81.
Note: you can also highlight cells that are less than a value, between a low and high value, etc.
Clear Rules
To clear a conditional formatting rule, execute the following steps.
Top/Bottom Rules
To highlight cells that are above the average of the cells, execute the following steps.
5. Click OK.
Result. Excel calculates the average (42.5) and formats the cells that are above this average.
Note: you can also highlight the top 10 items, the top 10 %, etc. The sky is the limit!
Manage Rules
To view all conditional formatting rules in a workbook, use the Conditional Formatting Rules Manager. You can also
Note: because we selected cell A1, Excel shows the rule applied to the range A1:A10.
4. From the drop-down list, change Current Selection to This Worksheet, to view all conditional formatting rules in this
worksheet.
Note: click New Rule, Edit Rule and Delete Rule to create, edit and delete rules.
Data Bars
Data bars in Excel make it very easy to visualize values in a range of cells. A longer bar represents a higher value.
1. Select a range.
Result:
Explanation: by default, the cell that holds the minimum value (0 if there are no negative values) has no data bar and
the cell that holds the maximum value (95) has a data bar that fills the entire cell. All other cells are filled proportionally.
Result. Excel updates the data bars automatically. Read on to further customize these data bars.
6. On the Home tab, in the Styles group, click Conditional Formatting, Manage Rules.
Excel launches the Edit Formatting Rule dialog box. Here you can further customize your data bars (Show Bar Only,
Minimum and Maximum, Bar Appearance, Negative Value and Axis, Bar Direction, etc).
Note: to directly launch this dialog box for new rules, at step 3, click More Rules.
8. Select Number from the Minimum drop-down list and enter the value 100. Select Number from the Maximum drop-
9. Click OK twice.
Result.
Explanation: the cell that holds the value 100 (if any) has no data bar and the cell that holds the value 150 (if any) has
a data bar that fills the entire cell. All other cells are filled proportionally.
Color Scales
Color Scales in Excel make it very easy to visualize values in a range of cells. The shade of the color represents the
1. Select a range.
Result:
Explanation: by default, for 3-Color scales, Excel calculates the 50th percentile (also known as median, middle value
or midpoint). The cell that holds the minimum value (9) is colored red. The cell that holds the median (36) is colored
yellow, and the cell that holds the maximum value (80) is colored green. All other cells are colored proportionally.
5. On the Home tab, in the Styles group, click Conditional Formatting, Manage Rules.
Excel launches the Edit Formatting Rule dialog box. Here you can further customize your color scale (Format Style,
7. Select 2-Color Scale from the Format Style drop-down list and select white and blue.
8. Click OK twice.
Result.
Icon Sets
Icon Sets in Excel make it very easy to visualize values in a range of cells. Each icon represents a range of values.
1. Select a range.
(max-min) = 2 + 0.67 * (95-2) = 64.31. 33th percent = min + 0.33 * (max-min) = 2 + 0.33 * (95-2) = 32.69. A green
arrow will show for values equal to or greater than 64.31. A yellow arrow will show for values less than 64.31 and equal
to or greater than 32.69. A red arrow will show for values less than 32.69.
Result. Excel updates the icon set automatically. Read on to further customize this icon set.
6. On the Home tab, in the Styles group, click Conditional Formatting, Manage Rules.
Excel launches the Edit Formatting Rule dialog box. Here you can further customize your icon set (Icon Style, Reverse
8. Select 3 symbols (Uncircled) from the Icon Style drop-down list. Select No Cell Icon from the second Icon drop-down
list. Change the Types to Number and change the Values to 100 and 0. Select the greater than symbol (>) next to the
value 0.
9. Click OK twice.
Result.
New Rule
If the Highlight Cells Rules, Top/Bottom Rules, Data Bars, Color Scales and Icon Sets are not sufficient, you can create
a new rule. For example, highlight the codes below that occur more than once in the range A2:A10 and have a score
Explanation: COUNTIF($A$2:$A$10,A2) counts the number of codes in the range A2:A10 that are equal to the code in
cell A2. If COUNTIF($A$2:$A$10,A2) > 1 and B2 > 100, Excel formats cell A2. Because we selected the range A2:A10
before we clicked on Conditional Formatting, Excel automatically copies the formula to the other cells. Thus, cell A3
this reference.
Find Duplicates
This example teaches you how to find duplicates (or triplicates) in Excel. Go here to remove duplicates.
Note: select Unique from the first drop-down list to highlight the unique names.
As you can see, Excel highlights duplicates (Juliet, Delta), triplicates (Sierra), quadruplicates (if we have any), etc.
Explanation: =COUNTIF($A$1:$C$10,A1) counts the number of names in the range A1:C10 that are equal to the name
in cell A1. If COUNTIF($A$1:$C$10,A1) = 3, Excel formats the cell. Because we selected the range A1:C10 before we
clicked on Conditional Formatting, Excel automatically copies the formula to the other cells. Thus, cell A2 contains the
Note: you can use any formula you like. For example, use this formula =COUNTIF($A$1:$C$10,A1)>3 to highlight the
1. Select a range.
Result.
Explanation: the MOD function gives the remainder of a division. The ROW() function returns the row number. For
example, for the seventh row, MOD(7,2) equals 1. 7 is divided by 2 (3 times) to give a remainder of 1. For the eight
row, MOD(8,2) equals 0. 8 is divided by 2 (exactly 4 times) to give a remainder of 0. As a result, all odd rows return 1
NFL teams.
To highlight the teams in the first list that are not in the second list, execute the following steps.
1. First, select the range A1:A18 and name it firstList, select the range B1:B20 and name it secondList.
Result. Miami Dolphins and Tennessee Titans are not in the second list.
Explanation: =COUNTIF(secondList,A1) counts the number of teams in secondList that are equal to the team in cell
A1. If COUNTIF(secondList,A1) = 0, the team in cell A1 is not in the second list. As a result, Excel fills the cell with a
blue background color. Because we selected the range A1:A18 before we clicked on Conditional Formatting, Excel
automatically copies the formula to the other cells. Thus, cell A2 contains the formula =COUNTIF(secondList,A2)=0,
8. To highlight the teams in the second list that are not in the first list, select the range B1:B20, create a new rule using
Result. Denver Broncos, Arizona Cardinals, Minnesota Vikings and Pittsburgh Steelers are not in the first list.
Conflicting Rules
Sometimes multiple conditional formatting rules in Excel conflict. A higher rule always wins. This example illustrates
1. The value 95 is higher than 80 but is also the highest value (Top 1). The formats (yellow fill vs green fill and yellow
text color vs green text color) conflict. A higher rule always wins. As a result, the value 95 is colored yellow.
Result:
2. Move the second rule up. The value 95 is the highest value (Top 1) but is also higher than 80. The formats (green
fill vs yellow fill and green text color vs yellow text color) conflict. A higher rule always wins. As a result, the value 95 is
colored green.
Result:
Note: only use the Stop If True check boxes for backwards compatibility with earlier versions of Microsoft Excel.
Checklist
This example teaches you how to create a checklist in Excel. First, turn on the Developer tab. Next, you can create a
checklist.
To create this checklist, execute the following steps.
6. Click on the lower right corner of cell B2 and drag it down to cell B11.
7. Right click the first check box and click Format Control.
8. Link the check box to the cell next to it (cell C2).
10. The count the number of items packed, insert a COUNTIF function into cell B14.
11. Hide column C.
Result:
Note: we created a conditional formatting rule to change the background color of cell B16 depending on the cell's value.