Skip to content
A paint roller coloring one spreadsheet row, illustrating conditional formatting based on another cell

EXCEL & GOOGLE SHEETS TIPS · LESSON 3

Conditional Formatting Based on Another Cell in Excel and Google Sheets

Color a whole row when one column says "Want", or turn an amount red when it is bigger than a limit you type in a separate cell. Both are conditional formatting rules with a custom formula. This lesson builds the two rules step by step in Excel and in Google Sheets, explains the dollar signs that make them work, and fixes the rules that color the wrong rows.

6 real screenshotsExcel and Google SheetsWhole-row highlightingFree example file
Screenshots: Microsoft Excel for Mac (Microsoft 365) and Google Sheets in Chrome, taken in November 2026. The menus are the same in Excel for Windows, except where noted.

THE SHORT ANSWER

Use a custom formula that points at the other cell

=$E2="Want"Select A2:E11, add a rule with this formula, pick a fill color. Every row whose column E says "Want" turns yellow. The $ locks column E; the row number 2 has no $, so each row checks its own E cell.
EXCEL

Select the range → Home → Conditional Formatting → New Rule → Use a formula to determine which cells to format → type the formula → Format… → pick a fill → OK.

GOOGLE SHEETS

Select the range → Format → Conditional formatting → Format cells if… → Custom formula is → type the same formula → choose a fill color → Done.

The example is the same expense log as lesson 1 (drop-down lists) and lesson 2 (VLOOKUP): the Type column is looked up from a Categories sheet, and now two rules color the log. Download the example file (Excel; it also opens in Google Sheets) to see both rules and change them.

HOW IT READS

Write the formula for the first row, lock the column

A conditional formatting formula must return TRUE or FALSE. You write it as if it were for the top-left cell of the range you selected, and the app copies it to every other cell the way a normal formula is copied down and across. That is why the dollar signs matter.

You writeWhat each cell checksResult
=$E2="Want"Every cell in row 5 checks E5, every cell in row 6 checks E6.The whole row is colored. This is what you want.
=E2="Want"Column A checks E, column B checks F, column C checks G…Only one column is colored, or nothing.
=$E$2="Want"Every cell checks E2 only.All rows or no rows are colored, depending on row 2.
=$E1="Want" with range from row 2Row 2 checks E1, row 3 checks E2…The color lands one row too low.
Rule of thumb: put a $ before the column letter of the cell you are testing (so it stays on that column), and no $ before the row number (so each row tests its own value). Put $ on both parts only for a single settings cell, like $I$1 below.

EXCEL

Highlight the whole row based on another cell in Excel

  1. Select the rows to color, here A2:E11. Start at row 2, not at the header.
  2. Open the rule editor: Home → Conditional Formatting → New Rule. On a Mac you can also use the menu bar: Format → Conditional Formatting… and click +.
  3. Choose the formula type. On Windows pick Use a formula to determine which cells to format. On a Mac keep Style: Classic and pick the same option from the second list.
  4. Type the formula =$E2="Want". Type it rather than clicking cells: a click inserts $E$2, which locks the row too.
  5. Pick the format: click Format… (Windows) or Format with → Custom Format… (Mac), choose a fill color, then OK.
Excel Edit Formatting Rule dialog with Use a formula to determine which cells to format and the formula =$E2="Want" with a yellow format
The rule in Excel for Mac: Classic style, "Use a formula…", the formula and a yellow custom format.

Press OK and every row whose Type is "Want" turns yellow. Change a category in column C (the Type updates by VLOOKUP) and the color follows by itself.

Excel expense log where the rows for Pizza night, Streaming service and Concert tickets are highlighted yellow because column E says Want, and amounts over 150 dollars are red
Rows 6, 7 and 10 are "Want" purchases. The red amounts come from the second rule below.

COMPARE WITH ANOTHER CELL

Turn amounts red when they are over a limit you type in a cell

Hard-coding a number (=$D2>150) works, but then every change means editing the rule. Put the limit in its own cell instead, here I1, and point the rule at it:

=$D2>$I$1Applied to D2:D11. Each amount is compared with the one value in I1. $I$1 is locked on both sides, so every row looks at the same cell.

Now the limit is a setting anyone can change. Type 80 in I1 and the groceries and electric bill turn red as well:

Excel sheet with Flag amounts over set to 80 dollars in I1 and more amounts highlighted red, including 86.40 and 92.15
Same rule, new limit in I1: $86.40, $92.15 and $118.00 are now flagged too. Nothing in the rule was edited.

To see, edit or reorder rules, open Home → Conditional Formatting → Manage Rules. Set "Show formatting rules for" to This Worksheet to list every rule on the sheet, not just those touching the selected cell.

Excel Manage Rules dialog listing two formula rules: =$E2="Want" applied to $A$2:$E$11 and =$D2>$I$1 applied to $D$2:$D$11
With an amount cell selected, "Current Selection" already lists both rules, their formats and ranges. The arrows at the top right change which rule wins when both are true.
When two rules hit the same cell: in Excel, both formats are applied, and where they clash (two fill colors) the rule higher in the list wins. Look at $118.00 in row 10 above: it is a "Want" row and over the $80 limit, so it keeps the yellow fill from rule 1 (listed first) and gets the red bold text from rule 2. Select rule 2 and move it up with the arrow if the red fill must win.

GOOGLE SHEETS

Conditional formatting based on another cell in Google Sheets

  1. Select A2:E11 and open Format → Conditional formatting. A panel opens on the right with the range already in "Apply to range".
  2. Under "Format cells if…", open the list and choose the last option, Custom formula is.
  3. Type =$E2="Want" in the box below it. The = sign is required.
  4. Pick the style: the paint bucket sets the fill, the B and A buttons set bold and text color. Click Done.
  5. Add the second rule: select D2:D11, click Add another rule, choose Custom formula is and type =$D2>$I$1.
Google Sheets conditional format rules panel with Apply to range A2:E11, Custom formula is =$E2="Want" and a yellow fill; Want rows are highlighted
Google Sheets shows a live preview while the panel is open. Range and formula are boxed.
Google Sheets expense log with Want rows highlighted yellow and amounts over 150 dollars highlighted red in bold
Both rules in Google Sheets: the same two formulas as in Excel.
Settings cell on another tab? Excel 2010 and later accept =$D2>Settings!$B$1 directly. Google Sheets doesn't allow references to other sheets in conditional formatting; wrap the reference in INDIRECT instead: =$D2>INDIRECT("Settings!B1"). In Sheets, when two rules hit the same cell, the rule listed first wins; drag the rules in the panel to reorder them.

COPY AND ADAPT

Ready-made formulas for common cases

Each works in both apps. Select the rows first (starting at row 2) and change the column letters to match your sheet.

GoalCustom formula
Row where a status cell says "Paid"=$F2="Paid"
Row where a checkbox is ticked=$G2=TRUE
Due date passed and not paid=AND($B2<TODAY(), $F2<>"Paid")
Text contains a word (any case)=ISNUMBER(SEARCH("ads", $B2))
Either of two values=OR($E2="Want", $E2="Savings")
Cell is empty (missing input)=$D2=""
Actual over budget in the next column=$C2>$B2
Every other row (zebra stripes)=ISEVEN(ROW())

Color scales and data bars color a cell by its own value, so use a formula rule whenever the condition lives in a different column. For the built-in "duplicate values" rule and its formula version, see lesson 7 (duplicates).

TROUBLESHOOTING

Conditional formatting based on another cell not working?

What you seeWhyFix
Only one column is coloredThe column letter has no $: =E2="Want".Use =$E2="Want".
The color is one row offThe formula is written for a different row than the first selected row (range starts at row 2, formula says row 1).Make the row number match the first row of "Applies to" / "Apply to range".
Every row or no row is coloredThe row is locked too: $E$2. Clicking a cell while typing the formula in Excel inserts this.Delete the second $ so it reads $E2.
Nothing happens with a number limitThe limit or the amounts are text that looks like a number (a leading apostrophe, or imported from a CSV).Retype the limit as a number; convert the column (Excel: warning icon → Convert to Number; Sheets: =VALUE() helper column).
"Invalid formula" in Google SheetsThe formula points to another tab, or uses typographic quotes copied from a document.Use INDIRECT("Sheet!A1"); retype the quotes as straight quotes.
Text rule misses some rowsExtra spaces: "Want " is not "Want". Case does not matter.Test with =TRIM($E2)="Want", or clean the column. A drop-down list prevents it.
New rows aren't coloredThe rule's range ends at row 11.Extend "Applies to" to $A$2:$E$500, or format the data as a table in Excel so the range grows.

FAQ

Conditional formatting questions

How do I apply conditional formatting based on another cell?

Select the cells to format, create a new rule with a custom formula (Excel: "Use a formula to determine which cells to format"; Google Sheets: "Custom formula is") and reference the other cell, for example =$E2="Want". The formula is written for the first row of the selection.

How do I highlight an entire row based on one cell?

Select the whole table without the header, for example A2:E11, and use a formula with a dollar sign before the column letter only: =$E2="Want". Every cell in a row then checks the same column E value.

How do I compare a cell with a value in another cell?

Use a rule such as =$D2>$I$1, where I1 holds the limit. Lock both parts of the settings cell with $ so every row compares with the same cell.

Can conditional formatting reference another sheet?

In Excel 2010 and later, yes: =$D2>Settings!$B$1. In Google Sheets, wrap it in INDIRECT: =$D2>INDIRECT("Settings!B1").

Why is my conditional formatting formula not working?

Most often the $ signs are in the wrong place, the formula is written for a different row than the first selected row, or the compared values are text instead of numbers. Check the rule in Manage Rules (Excel) or the Conditional format rules panel (Google Sheets).

Does Excel's custom formula match text in any case?

Yes. ="Want" also matches "want" and "WANT". Use EXACT($E2,"Want") if case must match.

Back to top