Conditional Formatting
Conditional Formatting
Conditional Formatting
• Conditional formatting allows you to automatically apply formatting—such
as colors, icons, and data bars—to one or more cells based on
the cell value.
• For example, a conditional formatting rule might be: If the value is less
than $2000, color the cell red.
How to create a conditional formatting
rule
• Select the desired cells for the conditional formatting
rule.
• From the Home tab, click the Conditional
Formatting command. A drop-down menu will appear.
• Hover the mouse over the desired conditional
formatting type, then select the desired rule from the
menu that appears.
• A dialog box will appear. Enter the desired value(s) into
the blank field.
• Select a formatting style from the drop-down menu.
• The conditional formatting will be applied to the
selected cells.
Highlight Cells Rules
• Select the range
• On the Home tab, in the Styles group, click
Conditional Formatting.
• Click Highlight Cells Rules,( say,Greater Than).
• Enter the value and select a formatting style.
• Click OK.
Clear Rules
• Select the dataset. In the example above, select A2:C13 (which excludes the header). If you want to
include the header as well, then select the entire data set.
• Open the Conditional Formatting dialogue box (Home–> Conditional Formatting–> New
Rule) [Keyboard Shortcut – Alt + O + D].
• In the dialogue box, select ‘Use a Formula to determine which cells to format’ dialogue box.
• Enter the following formula in the field in the ‘Edit the Rule Description’ section:
=ISODD(ROW())
• The above formula checks all the cells and if the ROW number of a cell is odd, then it returns TRUE.
The specified conditional format would be applied to all the cell that return TRUE.
• Set the format that you want to apply to the. To do this, click on the Format button. It will open the
‘Format Cells’ dialogue box, where you can specify the format.
• Click OK.
• Here are some examples:
• Highlight alternate even rows: =ISEVEN(ROW())
• Highlight alternate odd rows: =ISODD(ROW())
• Highlight every 3rd row: =MOD(ROW(),3)=0
Search and Highlight Data using
Conditional Formatting
• Suppose you have a dataset as shown below, with Products Name, Sales Rep, and Geography. The
idea is to type a string in cell C2, and if it matches with the data in any cell(s), then that should get
highlighted.
• Here are the steps to create this Search and Highlight functionality:
• Select the dataset.
• Go to Home –> Conditional Formatting -> New Rule (Keyboard Shortcut – Alt + O + D).
• In the New Formatting Rule dialogue box, select the option ‘Use a formula to determine which cells
to format’.
• Enter the following formula in the field in the ‘Edit the Rule Description’ section:
=AND($C$2<>"",OR(ISNUMBER(SEARCH($C$2,$B5:$D5))))
• Set the format that you want to apply to the cells that are blank or have errors. To do this, click on
the Format button. It will open the ‘Format Cells’ dialogue box, where you can specify the format.
• Click OK.
• The formula would return TRUE for a cell when two conditions are met:
• Cell C2 is not empty.
• The content of cell C2 exactly matches the content of the cell in the dataset.
Conditional formatting presets
• Excel has several predefined styles—or presets—you can use to quickly apply conditional
formatting to your data. They are grouped into three categories:
• Data Bars are horizontal bars added to each cell, much like a bar graph.
• Color Scales change the color of each cell based on its value. Each color scale uses a two- or
three-color gradient. For example, in the Green-Yellow-Red color scale, the highest values
are green, the average values are yellow, and the lowest values are red.
• Icon Sets add a specific icon to each cell based on its value.
References
• https://trumpexcel.com/excel-conditional-
formatting/#2
• https://exceljet.net/conditional-formatting-
formulas
• https://edu.gcfglobal.org/en/excel2016/condition
al-formatting/1/
• https://www.contextures.com/xlcondformat03.ht
ml#sample
• https://www.excel-easy.com/data-
analysis/conditional-formatting.html