0% found this document useful (0 votes)
86 views

Conditional Formatting in excel

The document provides a comprehensive guide on using conditional formatting in Excel, detailing various methods to highlight cells based on specific criteria. It covers techniques such as highlighting cells greater than a value, using formulas for custom formatting, managing rules, and visualizing data with color scales, data bars, and icon sets. Additionally, it explains how to find duplicates, shade alternate rows, and compare two lists using conditional formatting.

Uploaded by

anuanamika0220
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

Conditional Formatting in excel

The document provides a comprehensive guide on using conditional formatting in Excel, detailing various methods to highlight cells based on specific criteria. It covers techniques such as highlighting cells greater than a value, using formulas for custom formatting, managing rules, and visualizing data with color scales, data bars, and icon sets. Additionally, it explains how to find duplicates, shade alternate rows, and compare two lists using conditional formatting.

Uploaded by

anuanamika0220
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 48

Conditional Formatting

Highlight Cells Rules | Clear Rules | Top/Bottom Rules | Conditional


Formatting with Formulas | Color Scales | Highlight Blank Cells

Use conditional formatting in Excel to automatically highlight cells


based on their content. Simply apply a rule or use a formula to determine
which cells to format.

Highlight Cells Rules


To highlight cells that are greater than a value, execute the following
steps.

1. Select the range A1:A10.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Highlight Cells Rules, Greater Than.


4. Enter the value 80 and select a formatting style.

5. Click OK.

Result. Excel highlights the cells that are greater than 80.

6. Change the value of cell A1 to 81.

Result. Excel changes the format of cell A1 automatically.


Note: you can also use this category (see step 3) to highlight cells that are
less than a value, between two values, equal to a value, cells that contain
specific text, dates (today, last week, next month, etc.), duplicates or
unique values.

Clear Rules
To clear a conditional formatting rule, execute the following steps.

1. Select the range A1:A10.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Clear Rules, Clear Rules from Selected Cells.


Top/Bottom Rules
To highlight cells that are above average, execute the following steps.

1. Select the range A1:A10.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Top/Bottom Rules, Above Average.


4. Select a formatting style.

5. Click OK.

Result. Excel calculates the average (42.5) and formats the cells that are
above this average.
Note: you can also use this category (see step 3) to highlight the top n
items, the top n percent, the bottom n items, the bottom n percent or cells
that are below average.

Conditional Formatting with Formulas


Take your Excel skills to the next level and use a formula to determine
which cells to format. Formulas that apply conditional formatting must
evaluate to TRUE or FALSE.

1. Select the range A1:E5.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click New Rule.

4. Select 'Use a formula to determine which cells to format'.

5. Enter the formula =ISODD(A1)


6. Select a formatting style and click OK.

Result. Excel highlights all odd numbers.

Explanation: always write the formula for the upper-left cell in the selected
range. Excel automatically copies the formula to the other cells. Thus, cell
A2 contains the formula =ISODD(A2), cell A3 contains the formula
=ISODD(A3), etc.

Here's another example.

7. Select the range A2:D7.


8. Repeat steps 2-4 above.

9. Enter the formula =$C2="USA"

10. Select a formatting style and click OK.

Result. Excel highlights all USA orders.


Explanation: we fixed the reference to column C by placing a $ symbol in
front of the column letter ($C2). As a result, cell B2, C2 and cell D2 also
contain the formula =$C2="USA", cell A3, B3, C3 and D3 contain the
formula =$C3="USA", etc.

Color Scales
Use awesome color scales to assign different colors to different values.
This allows you to quickly identify high and low points in your dataset.

Tip: learn more about color scales and learn how to create this heat map.

Highlight Blank Cells


You can also use conditional formatting in Excel to format blank cells. This
is useful for ensuring data completeness and quickly shows where
information is missing.
Manage Rules
To view all conditional formatting rules in a workbook, use
the Conditional Formatting Rules Manager. You can also use this
screen to create, edit and delete rules.

1. Select cell A1.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Manage Rules.


The Conditional Formatting Rules Manager appears.

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.

To add data bars, execute the following steps.

1. Select a range.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Data Bars and click a subtype.


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.

4. Change the values.

Result. Excel updates the data bars automatically. Read on to further


customize these data bars.
5. Select the range A1:A10.

6. On the Home tab, in the Styles group, click Conditional


Formatting, Manage Rules.

7. Click Edit rule.

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-down list and enter the value
150.

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 value in the cell.

To add a color scale, execute the following steps.

1. Select a range.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Color Scales and click a subtype.

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.

Read on to further customize this color scale.

4. Select the range A1:A7.

5. On the Home tab, in the Styles group, click Conditional


Formatting, Manage Rules.

6. Click Edit rule.

Excel launches the Edit Formatting Rule dialog box. Here you can further
customize your color scale (Format Style, Minimum, Midpoint and
Maximum, Color, etc).

Note: to directly launch this dialog box for new rules, at step 3, click More
Rules.

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.

To add an icon set, execute the following steps.

1. Select a range.

2. On the Home tab, in the Styles group, click Conditional Formatting.


3. Click Icon Sets and click a subtype.

Result:
Explanation: by default, for 3 icons, Excel calculates the 67th percent and
33th percent. 67th percent = min + 0.67 * (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.

4. Change the values.

Result. Excel updates the icon set automatically. Read on to further


customize this icon set.

5. Select the range A1:A10.

6. On the Home tab, in the Styles group, click Conditional


Formatting, Manage Rules.

7. Click Edit rule.


Excel launches the Edit Formatting Rule dialog box. Here you can further
customize your icon set (Icon Style, Reverse Icon Order, Show Icon Only,
Icon, Value, Type, etc).

Note: to directly launch this dialog box for new rules, at step 3, click More
Rules.

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.

Find Duplicates
Duplicate Values | Triplicates | Duplicate Rows

This page teaches you how to find duplicate values (or triplicates) and
how to quickly find duplicate rows in Excel.

Duplicate Values
To find and highlight duplicate values in Excel, execute the following
steps.

1. Select the range A1:C10.

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Highlight Cells Rules, Duplicate Values.

4. Select a formatting style and click OK.


Result. Excel highlights the duplicate names.

Note: select Unique from the first drop-down list to highlight the unique
names.

Triplicates
By default, Excel highlights duplicates (Juliet, Delta), triplicates (Sierra),
etc. (see previous image). Execute the following steps to highlight
triplicates only.

1. First, clear the previous conditional formatting rule.

2. Select the range A1:C10.

3. On the Home tab, in the Styles group, click Conditional Formatting.

4. Click New Rule.


5. Select 'Use a formula to determine which cells to format'.

6. Enter the formula =COUNTIF($A$1:$C$10,A1)=3

7. Select a formatting style and click OK.

Result. Excel highlights the triplicate names.


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 cell A1. Always write the
formula for the upper-left cell in the selected range (A1:C10). Excel
automatically copies the formula to the other cells. Thus, cell A2 contains
the formula =COUNTIF($A$1:$C$10,A2)=3, cell A3 contains the formula
=COUNTIF($A$1:$C$10,A3)=3, etc. Notice how we created an absolute
reference ($A$1:$C$10) to fix this reference.

Note: you can use any formula you like. For example, use
=COUNTIF($A$1:$C$10,A1)>3 to highlight names that occur more than 3
times.

Duplicate Rows
To find and highlight duplicate rows in Excel, use COUNTIFS (with the
letter S at the end) instead of COUNTIF.

1. Select the range A1:C10.

2. On the Home tab, in the Styles group, click Conditional Formatting.


3. Click New Rule.

4. Select 'Use a formula to determine which cells to format'.

5. Enter the formula =COUNTIFS(Animals,$A1,Continents,$B1,Countries,


$C1)>1

6. Select a formatting style and click OK.


Note: the named range Animals refers to the range A1:A10, the named
range Continents refers to the range B1:B10 and the named range
Countries refers to the range C1:C10. =COUNTIFS(Animals,
$A1,Continents,$B1,Countries,$C1) counts the number of rows based on
multiple criteria (Leopard, Africa, Zambia).

Result. Excel highlights the duplicate rows.

Explanation: if COUNTIFS(Animals,$A1,Continents,$B1,Countries,$C1) > 1,


in other words, if there are multiple (Leopard, Africa, Zambia) rows, Excel
formats cell A1. Always write the formula for the upper-left cell in the
selected range (A1:C10). Excel automatically copies the formula to the
other cells. We fixed the reference to each column by placing a $ symbol
in front of the column letter ($A1, $B1 and $C1). As a result, cell A1, B1
and C1 contain the same formula, cell A2, B2 and C2 contain the formula
=COUNTIFS(Animals,$A2,Continents,$B2,Countries,$C2)>1, etc.

7. Finally, you can use the Remove Duplicates tool in Excel to quickly
remove duplicate rows. On the Data tab, in the Data Tools group, click
Remove Duplicates.

In the example below, Excel removes all identical rows (blue) except for
the first identical row found (yellow).
Shade Alternate Rows
Use Conditional Formatting | Apply a Table Style

To shade alternate rows in Excel, use conditional formatting or apply a


table style. Coloring every other row makes it easier to read your data.
Use Conditional Formatting
First, let's use conditional formatting to shade/highlight every other row in
Excel.

1. For example, select the range A1:D15 below.

Note: to apply the shading to the entire worksheet, select all cells on a
worksheet by clicking the Select All button (see orange arrow).

2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click New Rule.


4. Select 'Use a formula to determine which cells to format'.

5. Enter the formula =MOD(ROW(),2)=0

6. Select a formatting style and click OK.

Result.
Explanation: the MOD function gives the remainder of a division. The ROW
function returns the row number of a cell. For example, for the seventh
row, MOD(7,2) = 1 because 7 divided by 2 equals 3 with a remainder of 1.
For the eight row, MOD(8,2) = 0 because 8 divided by 2 equals 4 with a
remainder of 0. As a result, all cells in even rows return 0 and will be
shaded.

Apply a Table Style


If you're not a formula hero, apply a table style to quickly color alternate
rows in Excel.

1. Select any cell within a range.


2. On the Home tab, in the Styles group, click Format as Table.

3. Choose a table style with alternate row shading.


4. Click OK.

Result.
To change the color shading from rows to columns, execute the following
steps.

5. First, select a cell inside the table. Next, on the Table Design tab, in the
Table Styles Options group, uncheck Banded Rows and check Banded
Columns.

Result.
Note: use the filter arrows to sort and filter this table. Visit our chapter
about tables to learn more about this topic.

To convert this table into a normal range of cells (with banded rows or
banded columns), execute the following steps.

6. First, select a cell inside the table. Next, on the Table Design tab, in the
Tools group, click Convert to Range.

Result.
Compare Two Lists
This page describes how to compare two lists using conditional
formatting. For example, you may have two lists of 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.

2. Next, select the range A1:A18.

3. On the Home tab, in the Styles group, click Conditional Formatting.

4. Click New Rule.

5. Select 'Use a formula to determine which cells to format'.

6. Enter the formula =COUNTIF(secondList,A1)=0

7. Select a formatting style and click OK.


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. Always write the formula for the upper-
left cell in the selected range (A1:A18). Excel automatically copies the
formula to the other cells. Thus, cell A2 contains the formula
=COUNTIF(secondList,A2)=0, cell A3 =COUNTIF(secondList,A3)=0, etc.

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 the formula
=COUNTIF(firstList,B1)=0, and set the format to orange fill.

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 two different results.

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:

Heat Map
To create a heat map in Excel, simply use conditional formatting. A heat
map is a graphical representation of data where individual values are
represented as colors.

To create a heat map, execute the following steps.

1. Select the range B3:M11.


2. On the Home tab, in the Styles group, click Conditional Formatting.

3. Click Color Scales and click a subtype.


Result. A heat map with numbers.

4. Select the range B3:M11.

5. Right click, and then click Format Cells (or press CTRL + 1).

6. Select the Custom category.

7. Type the following number format code: ;;;


8. Click OK.

Result. A heat map in Excel.


Note: you can clearly see that the summer of 2014 in New York was cool
and that Christmas 2015 in New York was warm.

You might also like