Professional Documents
Culture Documents
10 Cool Ways To Use Excel's Conditional Formatting
10 Cool Ways To Use Excel's Conditional Formatting
1 of 16
SOFTWARE
Formatting, such as currency, alignment, and color, determines how Excel displays a value. But conditional formatting is
more flexible, applying specified formatting only when certain conditions are met. Here are some creative ways you can
push conditional formatting beyond its expected uses.
This article assumes a basic knowledge of Excel's conditional formatting feature. In Excel 2007 and 2010, Conditional
Formatting is in the Styles group on the Home tab. In Excel 2003, Conditional Formatting is on the Format menu.
Note: This list is also available as a photo gallery (http://www.techrepublic.com/photos/10-creative-uses-for-excels-conditional-formattingfeature/6357281),
techniques-excel-demo-files/4173225)
(xls and xlsx format) that includes examples of the techniques described here.
Figure A
Working with the time values complicates things a bit, as you can see in Figure B. This solution uses >.34 to represent
time values greater than eight hours, which will work in most cases -- you can't use the value 8 or even the time value
8:00. Or you could use the predefined Greater Than rule in Excel 2007 and 2010, which will automatically use the more
17/10/2014 11:26
2 of 16
Figure B
This formula returns True when a time value is greater than eight hours.
Figure C
First, select the values in column E and apply one of the default icon sets. Then, use Manage Rules to manipulate the
results. Figure D shows the final settings (click Reverse Icon Order first).
17/10/2014 11:26
3 of 16
Figure D
These settings display green and red icons to alert users to an overtime violation.
Figure E
17/10/2014 11:26
4 of 16
Select the entire data range (not the column headings) so Excel can format the entire record (row). Figure F shows the
formula-based settings. The $G2 component creates a relative address, which updates with each row: G4, G5, G6, and
so on. When the value in the referenced cell equals the string "Condiment," Excel highlights the entire row.
Figure F
You can highlight a row by applying the conditional format to the entire data range instead of a single column.
Figure G
17/10/2014 11:26
5 of 16
Figure H
With the list in place, update the conditional format formula to reference the input list cell, as shown in Figure I. Instead of
referencing a cell within the row, the formula references the validation list in B2. Selecting an item from the validation list
updates the conditional formatting.
Figure I
17/10/2014 11:26
6 of 16
This rule references the validation list instead of a literal string value.
5: Compare values
It's common to compare values. For instance, you might track inventory levels by comparing the stock on hand to a
reorder level. Using conditional formatting, you can alert users when it's time to reorder, as shown in Figure J. Select the
values you want to format -- in this case, that's B2:B46. (You could highlight the entire row or one of the inventory values.)
Then, apply the format shown in Figure K.
Figure J
Figure K
17/10/2014 11:26
7 of 16
This rule highlights the product in column A when the in stock value goes below the reorder level.
6: Compare lists
You can find discrepancies between two lists using a conditional formatting rule, as shown in Figure L. This rule, shown
in Figure M, compares each value in column A to its counterpart in column B. If they're not the same, Excel highlights the
value in column A. To highlight the values in column B instead, select the values in column B and update the rule formula
to reference the values in column A.
Figure L
This rule highlights values in column A when they differ from the values in column B.
Figure M
17/10/2014 11:26
8 of 16
Figure N
17/10/2014 11:26
9 of 16
Banding can improve readability, but you'll probably want to highlight even or odd rows and not both, as shown here.
Figure O
8: Find duplicates
To find duplicate values or records, you can use a filter, but conditional formatting can pinpoint duplicate values on the fly.
For instance, the sheet in Figure P shows duplicate values in a single column. Select the values you want to format and
apply the formula-based rule shown in Figure Q.
Figure P
17/10/2014 11:26
10 of 16
Figure Q
To ignore the first occurrence and highlight only subsequent values, use this formula:
=COUNTIF($A$2:$A2,A2)>1
If you want to check for duplicate values across multiple columns, concatenate the values and apply a similar rule to the
results, as shown in Figure R. You can also hide duplicates (which I don't always recommend) by selecting a font color
that matches the sheet's background.
Figure R
You can use Excel 2007 and 2010's built-in Find Duplicates rule, but it has a few limitations. First, you don't have much
flexibility with the actual formats. Second, this rule selects all duplicate values; you can't choose to ignore the first
occurrence and highlight just the subsequent values, as this more flexible formula-based rule can.
17/10/2014 11:26
11 of 16
9: Find discrepancies
Verifying data is an important task, and Excel's conditional formatting can help by alerting you to inconsistencies. Figure
S shows a common accounting tool known as cross-footing -- the process of double-checking totals by comparing
subtotals across rows and columns -- in cell F16. Adding the conditional format makes the discrepancy hard to miss when
the two totaling values don't match. Select either of the cross-foot formulas and apply the rule shown in Figure T.
Figure S
Figure T
17/10/2014 11:26
12 of 16
Figure U
Figure V
17/10/2014 11:26
13 of 16
A more complex rule highlights the smallest or largest duplicate value in a range.
This rule is unstable if you use normal referencing, so apply a range name to your data set before applying the conditional
formatting rule. The rule shown in Figure W will highlight the value 3 in the range named List only if 3 is also a duplicate.
To find the largest duplicate value, substitute the MIN() function with MAX().
Figure W
This rule ignores the smallest value unless it's also a duplicate value.
17/10/2014 11:26
14 of 16
Recommended
Editor's Picks
We-commerce: The
sharing economy's
uncertain path
17/10/2014 11:26
15 of 16
built Box
17/10/2014 11:26
16 of 16
17/10/2014 11:26