Managing conditional formatting rules in Excel: formula rules, the $ sign and Stop If True
The Conditional Formatting Rules Manager: highlight whole rows with a formula (=$C2>100), the $ sign trap, rule order, Stop If True and Applies to.
Built-in rules (Greater Than, Top 10, Data Bars) format only the cell itself. Real work usually asks for something else: “make the whole row green when the order is over 100 mln”, “grey out cancelled orders and don’t draw a data bar for them”.
That takes two skills: writing formula-based rules and using the Conditional Formatting Rules Manager, where every rule on the sheet is listed in one place. This is the “professional” side of conditional formatting.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz | Tashkent | 120 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 | Malika | Tashkent | 60 | Delivered | |
| 6 | Sardor | Namangan | 101 | In transit | |
| 7 | Nodira | Andijan | 95 | Delivered | |
| 8 |
Opening the Rules Manager
1
Главная → Условное форматирование → Manage Rules....
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz | Tashkent | 120 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 |
2
In Show formatting rules for, choose This Worksheet. By default only the rules of the selected cells are shown — which is why so many people think a rule “disappeared”.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz | Tashkent | 120 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 |
3
Each row shows: Rule — the condition, Format — what it looks like, Applies to — the range it affects, Stop If True — a box that halts the rules below. You can edit Applies to right here — no need to recreate the rule.
Highlighting a whole row with a formula
1
Select the table starting from A2, going down and right: A2:D7. The active cell must be A2 — the formula is written for that cell.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz1 | Tashkent | 120 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 | Malika | Tashkent | 60 | Delivered | |
| 6 | Sardor | Namangan | 101 | In transit | |
| 7 | Nodira | Andijan | 95 | Delivered | |
| 8 |
2
Условное форматирование → New Rule... → Use a formula to determine which cells to format. Type =$C2>100 in the box.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz | Tashkent | 120 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 | Malika | Tashkent | 60 | Delivered | |
| 6 | Sardor | Namangan | 101 | In transit | |
| 7 | Nodira | Andijan | 95 | Delivered | |
| 8 |
3
Format... → on the Fill tab pick light green, on the Font tab dark green → OK → OK.
4
Result: every row with more than 100 in column C is filled end to end.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz | Tashkent | 120 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 | Malika | Tashkent | 60 | Delivered | |
| 6 | Sardor | Namangan | 101 | In transit | |
| 7 | Nodira | Andijan | 95 | Delivered | |
| 8 |
Why =$C2 — what the $ sign does
The formula is written for the active cell (A2), and Excel then “copies” it into every cell of the range — just like filling an ordinary formula. So references shift as usual:
=$C2>100— correct. The $ locks the column: every cell in the row looks at column C. The row number has no $, so each row checks its own amount.=C2>100— A2 checks C2, B2 checks D2 (text!), C2 checks E2 (empty). You get random, patchy formatting.=$C$2>100— every cell looks at C2 only. Since C2 = 120, the whole table turns green.
The rule of thumb: $ before the column, none before the row.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz | Tashkent | 1201 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 | Malika | Tashkent | 60 | Delivered | |
| 6 | Sardor | Namangan | 101 | In transit | |
| 7 | Nodira | Andijan | 95 | Delivered | |
| 8 |
Rule order and Stop If True
Rules in the manager are evaluated top to bottom. When two rules change the same property (say, fill color), the higher one wins. Properties that don’t clash (one sets fill, another sets bold) are applied together. Change the order with the Move Up / Move Down arrows in the dialog.
Stop If True means “if this condition is met, don’t evaluate the rules below for this cell”. In our example the “Cancelled” rule is at the top with Stop If True on. So Javohir’s row (150 mln) doesn’t turn green and C4 gets no data bar — a cancelled order doesn’t look like a real sale.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | |
| 2 | Aziz | Tashkent | 120 | Delivered | |
| 3 | Dilnoza | Samarkand | 85 | In transit | |
| 4 | Javohir | Bukhara | 150 | Cancelled | |
| 5 |
Pro level: handy formula rules and “fragmented” rules
A formula rule just needs to return TRUE or FALSE, so any function works (for A2:D7 with A2 active):
=$C2=МАКС($C$2:$C$7)— the row with the largest order.=СЧЁТЕСЛИ($A$2:$A$7;$A2)>1— repeat clients.=И($D2<>"Delivered";$E2<СЕГОДНЯ())— overdue orders not yet delivered (E is the due date).=ОСТАТ(СТРОКА();2)=0— shade every other row (zebra stripes).
Fragmented rules. Copying and pasting rows, inserting and cutting split one rule into dozens of copies: =$A$2:$D$5, =$A$7:$D$9, =$A$12:$D$12... The file slows down and colors behave oddly. The cure: in the manager choose This Worksheet, remove the extra copies with Delete Rule, and set the remaining rule’s Applies to to the full range.
A pro habit: before putting a complex formula into a rule, test it in a helper column — the rows showing TRUE are the ones that will be formatted.
Try it in the simulator
Test the formula before creating the rule: type =$C2>100 in E2 and fill down to E7 — rows showing TRUE will turn green. Then type =И($C2>100;$D2<>"Cancelled") in F2, fill it down and see why Javohir gets FALSE.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Client | City | Amount, mln | Status | > 100? | Not cancelled and > 100? | ||||||||||||||||||
| 2 | Aziz | Tashkent | 120 | Delivered | ||||||||||||||||||||
| 3 | Dilnoza | Samarkand | 85 | In transit | ||||||||||||||||||||
| 4 | Javohir | Bukhara | 150 | Cancelled | ||||||||||||||||||||
| 5 | Malika | Tashkent | 60 | Delivered | ||||||||||||||||||||
| 6 | Sardor | Namangan | 101 | In transit | ||||||||||||||||||||
| 7 | Nodira | Andijan | 95 | Delivered | ||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.