Conditional formatting rules: new, edit and manage: practice exercises
New Formatting Rule, Manage Rules, Edit Rule, Applies to, Stop If True, Clear Rules, formula rules. 8 exercises on real-looking data, each checked as you go. The full lesson is part of Pro.
This lesson has Excel's New Formatting Rule box and Rules Manager above a practice sheet: make, edit, order and clear rules as you would in Excel, and each task is checked as you go.
Open the Conditional formatting rules: new, edit and manage lesson
How it works
The quick rules (Greater Than, Top 10) use a ready-made format. New Rule lets you pick your own format, such as a Light Green fill in bold, or use a formula to decide which cells to format.
The Rules Manager shows every rule: change one, change the cells it applies to, put the rules in order, and use Stop If True so a rule higher up keeps the ones below from applying. Clear Rules takes them off.
A new rule with your own format
The quick rules on the Conditional Formatting menu (Greater Than…, Top 10 Items…) offer a few ready-made formats, such as Light Red Fill with Dark Red Text. New Rule… lets you choose everything.
Select the Q2 sales (C2:C12), then Home, Conditional Formatting, New Rule…. Pick a rule type:
- Format only cells that contain: Cell Value greater than 5000.
- Format only top or bottom ranked values: Top 3.
- Format only values that are above or below average, or unique or duplicate values.
- Use a formula to determine which cells to format: see below.
Then Format… sets the look: a fill colour such as Light Green, a font colour, bold, italic.
Windows: Home, Conditional Formatting, New Rule….
Mac: Home, Conditional Formatting, New Rule…; set Style to Classic to see these rule types, then Format with: custom format….
A rule with a formula
To format the names where Q2 beat Q1, the rule needs to look at other columns. Select the names, A2:A12, choose Use a formula to determine which cells to format, and type a formula for the first row, row 2: =$C2>$B2.
The $ before C and B keeps the columns fixed; the 2 has no $, so for A3 Excel checks $C3>$B3, and so on. Where the formula is TRUE, the cell gets the format.
Manage Rules: edit, Applies to and order
Conditional Formatting, Manage Rules… lists the rules. Show formatting rules for picks the selection's rules or the whole worksheet's.
- Edit Rule… changes a rule, such as greater than 5000 to greater than or equal to 6000. New Rule… and Delete Rule are beside it, and Duplicate Rule copies one.
- Applies to is the cells the rule covers. Rows added under the list aren't covered: change =$C$2:$C$11 to =$C$2:$C$14.
- Rules are checked from the top. When two set the same thing, such as the fill, the one higher up wins. Move Up and Move Down (▲ ▼) change the order.
Windows: Home, Conditional Formatting, Manage Rules….
Mac: Home, Conditional Formatting, Manage Rules…; the order arrows and Stop If True are at the side and bottom of the list.
Stop If True
Two rules can both apply to a cell: a top-5 rule fills it yellow, and a £9,000-or-more rule makes it bold, so a sale of £9,500 is both. To keep the £9,000 sales bold without the yellow, put the bold rule above the yellow one and tick its Stop If True: when it's true for a cell, Excel doesn't look at the rules below it for that cell.
Clear Rules
Conditional Formatting, Clear Rules has Clear Rules from Selected Cells (select the cells first) and Clear Rules from Entire Sheet. Cell formats set on the Home tab stay. To take off just one rule, delete it in Manage Rules instead.
What you'll practise
- Make the Q2 sales over £5,000 stand out with a format of your own. Select C2:C13, then Home, Conditional Formatting, New Rule…. Choose Format only cells that contain: Cell Value, greater than, 5000. Then set the format: Light Green fill and Bold.
- Highlight the top 3 Q1 sales. Select B2:B11, then Conditional Formatting, Top/Bottom Rules, Top 10 Items…; change 10 to 3, and in the list beside it pick Yellow Fill with Dark Yellow Text.
- The target has gone up: Q2 sales of £6,000 or more should be green now. Change the rule you have. Click in C2:C11, then Conditional Formatting, Manage Rules…, pick the rule and Edit Rule…. Make it greater than or equal to 6000, and keep its format.
- Three new salespeople were added in rows 12 to 14, but the rule for Q2 sales over £5,000 only covers C2:C11. Open Manage Rules… (Show formatting rules for: This Worksheet) and change the rule's Applies to box to =$C$2:$C$14.
- Two rules colour the Q2 sales: over £8,000 Light Green, and over £5,000 Yellow. But sales over £8,000 show yellow too, because the Yellow rule is above the green one, and the rule nearer the top wins. In Manage Rules…, select the Cell Value > 8000 rule and press Move Up (▲).
- The top 5 Q2 sales are filled yellow, and sales of £9,000 or more are bold. Sales of £9,000 or more should be bold only, with no yellow. In Manage Rules…, tick Stop If True for the Cell Value >= 9000 rule, so the rules below it don't apply to those cells.
- Remove all conditional formatting from cells B2:B12. Do not change the conditional formatting of any other cells.
- Use a formula to apply bold italic formatting to the names in cells A2:A13 when the Q2 sales are greater than the Q1 sales.
Guide with worked examples: Conditional formatting with a formula: colour a whole row