MSBA-171 · Lesson 10 of 12 · 22 min
Conditional formatting
▶ Video coming soon A video version of this lesson is on the way.
Rosalind did not want to read 430 rows. She wanted to glance at the bookings sheet and see what needed attention: overdue deposits in red, big events in bold, a sense of which months were busy. On the tenth Tuesday Dagny showed Teo the exam's "summarize data visually" objective: insert sparklines, apply built-in conditional formatting, and remove conditional formatting.
What conditional formatting does
Conditional formatting changes how a cell looks depending on its value. Unlike ordinary formatting, it updates by itself: when a deposit is paid and the status changes from Overdue to Paid, the red fill disappears. The rule lives with the cells, and you manage it rather than the formatting itself. Everything is on Home > Styles > Conditional Formatting.
Highlight Cells Rules
The first submenu compares each cell with a value you type and applies a format when the comparison is true. Each choice opens a small dialog with a value box and a format list, which offers presets such as Light Red Fill with Dark Red Text, Yellow Fill with Dark Yellow Text, Green Fill with Dark Green Text and Custom Format.
| Rule | Highlights cells that | Maple & Pine use |
|---|---|---|
| Greater Than | Exceed a value | Fees over 10,000 |
| Less Than | Are below a value | Guest counts under 30 |
| Between | Fall in a range, inclusive | Events between two dates |
| Equal To | Match a value exactly | Status equal to Overdue |
| Text that Contains | Contain some text | Client names containing Rotary |
| A Date Occurring | Fall in a period such as Last 7 Days or Next Month | Events next month |
| Duplicate Values | Repeat (or are unique) | Duplicate enquiry IDs |
The value box can hold a cell reference instead of a typed number. Pointing it at a cell with the threshold, such as the "large event" guest number on the Settings sheet, lets Rosalind change the threshold later without editing the rule. In the dialog the reference appears with dollar signs, as an absolute reference.
Worked problem
Highlighting overdue deposits
In the Bookings table, the Status column shows Paid, Due later or Overdue. Highlight Overdue with a light red fill and dark red text.
Show solution
- Select the data cells of the Status column (click the column heading inside the table just above the first value, so the whole column selects).
- Choose Conditional Formatting > Highlight Cells Rules > Equal To.
- Type Overdue in the value box.
- Choose Light Red Fill with Dark Red Text and select OK.
Answer: Every Overdue status turns red, and the formatting moves as statuses change. Because the range is a table column, new rows get the rule too.
Top/Bottom Rules
The second submenu ranks cells against each other rather than against a fixed value. Top 10 Items, Top 10 Percent, Bottom 10 Items, Bottom 10 Percent, Above Average and Below Average each open a dialog where you can change the number and the format. Teo applied Top 10 Items, changed to 5, with a green fill on the Fee column: the year's five biggest events lit up, and the selection changed as new bookings arrived.
Data Bars, Color Scales and Icon Sets
The other three families format every cell in the range by its relative size, giving a picture of the whole column at once:
| Type | What it shows | Good for | Watch out for |
|---|---|---|---|
| Data Bars | A bar inside each cell, longer for larger values; gradient or solid fill | Comparing amounts down a column | Negative numbers show bars to the left of an axis |
| Color Scales | A fill colour from a two- or three-colour gradient | Spotting highs and lows in a grid, such as bookings by month | Red-green scales are hard for colour-blind readers |
| Icon Sets | An icon per cell from a set of three to five, such as arrows, flags or ratings | Grouping values into bands | Default bands split the range into equal thirds, which may not match your meaning |
Dagny put a three-colour scale on a grid of events per month by venue, and the busy summer weekends showed at a glance. She deliberately chose the White - Blue scale instead of the red-green one so that everyone in the office could read it.
Managing rules
Every rule you add is listed in the Conditional Formatting Rules Manager (Conditional Formatting > Manage Rules). Its Show formatting rules for list switches between the current selection, this worksheet, other sheets and tables. For each rule you see the rule, its format, the range it Applies to, and a Stop If True check box. Buttons create a New Rule, Edit Rule or Delete Rule, and the arrows change the order.
Order matters when rules overlap. Excel evaluates rules from the top of the list down. If two rules apply formats that conflict, such as two different fill colours, the higher rule wins; formats that do not conflict, such as one rule's fill and another's bold, both apply. Stop If True stops lower rules from applying when a rule is true. Rosalind wanted Overdue in red to win over the top-five green fill, so Teo moved the Overdue rule to the top.
You can edit a rule's Applies to range directly in the Rules Manager, which is how you extend a rule to new rows in a plain range. Rules on whole table columns extend automatically.
New Rule and formula-based rules
New Rule opens a dialog with six rule types: format all cells based on their values (where data bars, colour scales and icon sets are configured in detail), format only cells that contain, format only top or bottom ranked values, format only values above or below average, format only unique or duplicate values, and use a formula to determine which cells to format. The formula type is powerful but is an Expert exam topic; for MO-210, the built-in rules are enough. Dagny showed it anyway: a formula rule can highlight a whole row, not just one cell, when the row's status is Overdue.
Applies to: =$A$2:$H$430
Formula: =$G2="Overdue"
Format: light red fill
The column is fixed (G), the row is relative (2), so each row tests its own status.Removing conditional formatting
The exam asks you to remove conditional formatting, and there are three ways depending on scope:
| To remove | Command |
|---|---|
| Rules from the selected cells | Conditional Formatting > Clear Rules > Clear Rules from Selected Cells |
| Every rule on the sheet | Conditional Formatting > Clear Rules > Clear Rules from Entire Sheet |
| Rules from a table | Click in the table > Clear Rules > Clear Rules from This Table |
| One specific rule | Manage Rules, select the rule, Delete Rule |
Clear Formats (lesson 4) also removes conditional formatting from the selection along with all other formatting, which is rarely what you want. The Quick Analysis button that appears at the lower right of a selection has a Formatting tab with data bars, colour scales, icon sets, greater than, top 10 and Clear Format, a quick route for the most common rules.
Sparklines
Sparklines are tiny charts that live inside a single cell. They show a trend in a row of numbers without the space a full chart needs, and they sit right beside the data they summarize. Excel has three types:
| Type | Shape | Use |
|---|---|---|
| Line | A small line chart | Trends over time, such as bookings per month |
| Column | Small vertical bars | Comparing values in a row |
| Win/Loss | Bars of equal height above or below a line | Positive versus negative, such as months over or under target |
Worked problem
Adding line sparklines to a monthly summary
The Monthly sheet lists five venues in A3:A7 with bookings for January to December in B3:M7. Add a line sparkline for each venue in column N.
Show solution
- Select B3:M7 (or select N3:N7 first).
- Choose Insert > Sparklines > Line.
- In Create Sparklines, the Data Range is B3:M7; set Location Range to N3:N7 and select OK.
- On the Sparkline tab, check High Point and Low Point, and choose a style.
Answer: Each cell in N3:N7 shows its venue's year as a line, with the busiest and quietest months marked.
Selecting a sparkline opens the contextual Sparkline tab. Its groups change the Type (Line, Column, Win/Loss), Show markers (High Point, Low Point, Negative Points, First Point, Last Point, Markers), Style and colours, and the Axis options, including making all sparklines in a group share the same minimum and maximum so they can be compared fairly. Sparklines created together form a group: changing one changes all. Ungroup separates them. To remove sparklines, use Clear on the Sparkline tab; pressing Delete does not remove them.
Sparklines respond to the row height and column width of their cell, so widen the column for a clearer line. Since a sparkline has no labels, put the numbers or at least the first and last values nearby.
Using visual summaries well
Conditional formatting and sparklines are most useful when they answer a specific question. Dagny's rule of thumb was one meaning per colour: red for "act now", green for "good news", no other fills on the sheet. Teo first applied a colour scale, an icon set and data bars to the same Fee column; the result was unreadable, and he cleared two of them. Colour should not be the only signal either: the Overdue rule also made the text bold, and the Status column still said Overdue in words, so the meaning survived printing in black and white and was clear to colour-blind readers.
Quick Analysis
Select a range of numbers and a small Quick Analysis button appears at its lower-right corner (or press Ctrl+Q). Its tabs offer instant previews: Formatting (data bars, colour scales, icon sets, greater than, top 10 percent and clear format), Charts, Totals, Tables and Sparklines. Pointing to an option previews it on the sheet; clicking applies it. Quick Analysis applies the same built-in rules as the ribbon, so it is a perfectly good route on the exam, but it offers fewer choices: for example, its greater-than option opens the same dialog, while its top option is fixed at ten percent rather than ten items.
Conditional formatting and tables
Rules applied to a whole table column follow the table as it grows, and the Rules Manager shows their Applies to range as a structured reference or as a range that extends automatically. Rules applied to only part of a column do not grow, which is why Teo always selected the whole column inside the table before adding a rule. When a table is sorted or filtered, conditional formatting stays with the values, not the positions: a highlighted fee moves with its row.
Editing an existing rule
To change a rule rather than add a new one, open Manage Rules, set Show formatting rules for to This Worksheet so you can see everything, select the rule and choose Edit Rule. The Edit Formatting Rule dialog shows the rule type, the condition and the format. Teo changed the Top 10 rule to Top 5 this way and changed its colour from green to the brand gold. Editing keeps the rule's place in the order and its Applies to range, which a delete-and-recreate does not.
A checklist for the exam
| Task wording | Where to go |
|---|---|
| Apply a built-in conditional format to highlight cells greater than | Highlight Cells Rules > Greater Than |
| Highlight the top or bottom values | Top/Bottom Rules |
| Apply data bars, a colour scale or an icon set | The matching submenu, choosing the named style |
| Remove conditional formatting from a range | Clear Rules > Clear Rules from Selected Cells |
| Insert sparklines | Insert > Sparklines, then Location Range |
| Show markers or high points on sparklines | Sparkline tab > Show group |
Read the task for the exact preset: "Light Red Fill" and "Light Red Fill with Dark Red Text" are different choices in the format list, and the checker can tell them apart. Gradient Fill and Solid Fill data bars are different too, as are the named colour scales such as Green - Yellow - Red Color Scale.
Common mistakes
MistakeApplying conditional formatting manually to cells that change.
InsteadUse a rule so the formatting follows the values.
MistakeStacking several rule types on the same range.
InsteadUse one clear rule per question, and check the order in Manage Rules.
MistakePressing Delete to remove sparklines.
InsteadUse Clear on the Sparkline tab.
MistakeUsing Clear Formats to remove one rule.
InsteadUse Clear Rules or delete the rule in Manage Rules.
MistakeRelying on red and green alone.
InsteadChoose colour-blind-friendly scales and add text or bold as a second signal.
Summary and key terms
- Conditional formatting applies formats by rule and updates as values change.
- Highlight Cells and Top/Bottom rules compare cells with values or rank them; data bars, colour scales and icon sets show relative size.
- Manage Rules lists, edits, reorders and deletes rules; higher rules win conflicts.
- Clear Rules removes rules from the selection, the sheet or a table.
- Sparklines are line, column or win/loss charts in one cell, formatted on the Sparkline tab and removed with Clear.
- Conditional formatting
- Formatting applied by a rule that depends on cell values.
- Highlight Cells Rules
- Built-in rules comparing each cell with a value or text.
- Data bar
- A bar inside a cell whose length reflects the value.
- Color scale
- A fill gradient reflecting values across a range.
- Icon set
- Icons assigned to bands of values.
- Rules Manager
- The dialog that lists and manages conditional formatting rules.
- Sparkline
- A small chart inside a single cell.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Which submenu holds Duplicate Values?
Show answer
Highlight Cells Rules.
How do you show only the five largest fees in green?
Show answer
Top/Bottom Rules > Top 10 Items, change 10 to 5, choose a green format.
Two rules apply conflicting fills to a cell. Which wins?
Show answer
The rule higher in the Rules Manager.
What are the three sparkline types?
Show answer
Line, Column and Win/Loss.
How do you remove every conditional formatting rule from a sheet?
Show answer
Conditional Formatting > Clear Rules > Clear Rules from Entire Sheet.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.