Apply it to Conditional Formatting:
Replace:
=A4=A3
With:
=A4=CellAbove
This method works just like OFFSET, but without any performance penalty. And you can use the same trick to define CellBelow, CellLeft, or CellRight.
OFFSET vs. CellAbove - Which Should You Use?
Both solutions prevent your conditional formatting rules from fragmenting:
Method | Pros | Cons |
OFFSET | Easy to implement, flexible | Volatile - may slow down files |
CellAbove | Efficient, non-volatile | Slightly more setup required |
Try both and see which fits your workflow best.
A Note on Merged Cell Effects with
Filtering
If you’re using conditional formatting to simulate merged cells like I did in the Dynamic Merged Cells in Excel post, you might notice a quirk when
filtering.
Problem:
In the image below you can see that when filtering by values like “Pending,” previously hidden department names (e.g., “Sales”) may appear again if rows for other statuses (e.g., “Paid” or “Overdue”) are hidden in
between.

Fix:
Use a formula with SUBTOTAL and OFFSET to check visibility and avoid displaying duplicates when filtering.
Example:
=AND(A4=OFFSET(A4,-1,0),SUBTOTAL(103,OFFSET(A4,-1,0)))
This ensures repeated values are only hidden when their preceding row is visible; preventing those odd visual glitches after filtering.
Note: it’s important
to only format the border for the top of the cells for this to work. Don’t use ‘all borders’ formatting.
Want More Excel Tricks?
If you’re tired of fixing broken formatting or wondering why formulas aren’t working, my Excel courses teach you how to build spreadsheets that just work. They’re step-by-step, practical, and come with personal support from me.