To highlight an entire row based on the value in one of its cells, use conditional formatting with a formula that references that cell with a mixed reference (for example, =$C2="Yes") applied to the whole table range. This works in Excel, Google Sheets, and LibreOffice Calc, and it updates automatically when cell values change.
Why Row Highlighting Matters
Scanning a long table for rows that meet a condition is slow and error-prone. Conditional formatting solves this by applying a visual rule: when a cell in a row matches your criterion, the whole row changes appearance. Common uses include flagging overdue tasks, marking completed items, highlighting values above a threshold, or shading rows that belong to a particular category.
The key advantage over manual shading is that the formatting is dynamic. If a status cell changes from "Open" to "Closed," the row colour updates instantly without any further action. This makes the technique useful for dashboards, checklists, project trackers, and any spreadsheet where data changes over time.
How Conditional Formatting Works
Conditional formatting evaluates a rule against each cell in a selected range. When you use a formula-based rule, the formula is written relative to the top-left cell of the selection, and the spreadsheet adjusts it for every other cell. This is why the reference style matters so much.
Excel and Google Sheets both use the same reference logic:
- A1 (relative column, relative row): both parts shift as the rule is applied across the range.
- $A1 (absolute column, relative row): the column stays fixed while the row number changes.
- A$1 (relative column, absolute row): the row stays fixed while the column changes.
- $A$1 (absolute both): the reference never changes.
For row highlighting, you almost always want $A1 style: the column letter is locked so every cell in the row checks the same column, while the row number is relative so each row is evaluated independently.
Step-by-Step in Excel
- Select the entire range you want to format, including all columns and rows (for example,
A2:F100). Do not include the header row unless you want it evaluated too. - Go to Home > Conditional Formatting > New Rule.
- Choose Use a formula to determine which cells to format.
- Enter a formula such as
=$C2="Complete". The row number should match the first row of your selection. - Click Format, choose a fill colour or font style, and confirm.
- Click OK to apply the rule.
If your data starts on row 2, the formula must reference row 2. A common mistake is writing =$C1 when the selection starts at row 2, which shifts the evaluation by one row and highlights the wrong records.
Step-by-Step in Google Sheets
- Select the range, such as
A2:F100. - Open Format > Conditional formatting.
- Under "Format cells if," choose Custom formula is.
- Enter the same style of formula:
=$C2="Complete". - Pick a formatting style and click Done.
Google Sheets applies the rule in the same relative way, so the formula must be anchored to the first cell of the selected range. The sidebar shows a preview of the range, which helps confirm the rule is applied where intended.
Common Formula Patterns
Different conditions require slightly different formulas. All examples assume the selection starts at row 2 and the deciding value is in column C.
- Exact text match:
=$C2="Yes" - Number threshold:
=$C2>100 - Blank cell:
=$C2="" - Non-blank cell:
=$C2<>"" - Text contains a word:
=ISNUMBER(SEARCH("urgent",$C2)) - Multiple conditions (AND):
=AND($C2="Open",$D2<TODAY()) - Multiple conditions (OR):
=OR($C2="High",$C2="Critical")
Text comparisons in Excel are not case-sensitive by default, so ="yes" matches "Yes" and "YES." Google Sheets behaves the same way. If case matters, use the EXACT function.
Common Problems and Fixes
Most failures come from reference or range mistakes rather than from the formatting feature itself.
- Wrong rows highlighted: The formula's row number does not match the first row of the selection. Adjust it so the two align.
- Only one column highlights: The column reference is relative instead of absolute. Change
C2to$C2. - Rule does not apply to new rows: The original range did not include them. Either extend the range or convert the data to an Excel Table, which expands formatting automatically.
- Formatting conflicts: Multiple rules can overlap. Use the rule manager to set priority or add "Stop if true" where appropriate.
- Text looks like a number: Values stored as text may not compare as expected. Check alignment or use
VALUE()to convert.
A frequent misconception is that conditional formatting can change a cell's underlying value. It cannot; it only changes appearance. To actually modify data based on a condition, you need formulas in separate cells or a script.
Alternatives to Conditional Formatting
Conditional formatting is the standard approach, but other options exist depending on the goal.
- Excel Tables: Built-in banded rows improve readability but do not respond to cell values.
- Filtering: Hides rows that do not match, which is useful for analysis but does not colour anything.
- Helper columns: A formula column can flag rows, which can then be sorted or filtered.
- Scripts and macros: For complex or multi-sheet rules, automation may be more practical than many conditional formatting rules.
For most everyday needs, conditional formatting remains the simplest and most maintainable choice.
Frequently Asked Questions
Can I highlight a row based on text in any cell of that row?
Yes. Use a formula that searches the whole row, such as =COUNTIF($A2:$F2,"urgent")>0, applied to the full range. This highlights the row if any cell in the specified columns contains the word.
Why does my formula highlight the wrong row?
The row number in the formula does not match the first row of the selected range. If your selection starts at row 3, the formula should reference row 3, for example =$C3="Yes".
Does conditional formatting work in Excel Online and Google Sheets?
Yes. Both support formula-based conditional formatting with the same reference rules, although the menus and dialog layouts differ slightly.
Can I highlight an entire row based on a date?
Yes. Formulas such as =$C2<TODAY() highlight rows with dates in the past, and =AND($C2>=TODAY(),$C2<=TODAY()+7) highlights dates within the coming week.
Will the highlighting survive if I sort or filter the data?
Yes. Conditional formatting rules move with the cells they apply to, so sorting and filtering do not break the logic as long as the rule range covers the data.
Can I copy conditional formatting to another sheet?
Yes, in most spreadsheet programs you can copy a formatted range and use paste special to transfer only the formatting, or recreate the rule on the target sheet.