CoreGPT
Google Workspace10 min read

Conditional Formatting in Google Sheets: Rules, Custom Formulas and Fixes

Set up conditional formatting in Google Sheets with built-in rules and color scales, then use custom formulas to highlight a whole row, format based on another cell, flag duplicates and overdue dates, plus how to fix rules that hit the wrong rows.

Conditional Formatting in Google Sheets: Rules, Custom Formulas and Fixes

To use conditional formatting in Google Sheets, select your cells and go to Format → Conditional formatting. A Conditional format rules panel opens on the right: check the Apply to range, pick a condition under Format cells if… (such as Text is exactly, Date is before or Greater than), choose a Formatting style, and click Done. For anything the list doesn't cover, like coloring a whole row, choose Custom formula is and type a formula that returns TRUE for the cells you want formatted.

Most broken rules come down to one detail: a custom formula is written for the first cell of the range, and the $ signs decide what changes as Sheets applies it to the other cells. Lock the column ($C2) and leave the row free, and the rule works on every row.

What you wantWhere to set itExample
Highlight cells with certain textFormat cells if… → Text is exactly or Text containsStatus is "Done"
Flag numbers above or below a valueGreater than, Less than, Is betweenBudget over 5,000
Flag datesDate is before, Date is after, Date isDue date before today
Find empty cellsIs emptyMissing owner
Shade cells from low to highColor scale tabScores from red to green
Highlight a whole row, duplicates, or compare cellsCustom formula is=$C2="Done"

Add a conditional formatting rule in Google Sheets

Say you have a task tracker in A1:D10 with Task in column A, Owner in B, Status in C and Due date in D. To turn every "Done" status green:

  1. Select C2:C10 (the Status cells, without the header).
  2. Click Format → Conditional formatting. The Conditional format rules panel opens with the Single color tab selected.
  3. Check Apply to range. It shows your selection (C2:C10); you can type a different range here, or several ranges separated by commas.
  4. Under Format rules, open Format cells if… and choose Text is exactly, then type Done in the value box.
  5. Under Formatting style, pick a preset or set your own Fill color and Text color. Bold, italic, underline and strikethrough are there too.
  6. Click Done.

The Google Sheets Conditional format rules panel on the Single color tab, with Apply to range set to C2:C10, Format cells if set to Text is exactly with the value Done, a green Formatting style, and the Done button

The rule updates live: change a status to "Done" and the cell turns green. Rules can change text color, fill color and the four text styles, but not the font, font size or borders.

The Format cells if… list also has Is empty, Text contains, Date is before and Date is after (with options such as today or in the past week), and number rules like Greater than and Is between. In Text contains, * matches any run of characters and ? a single one.

Use a color scale instead

Switch to the Color scale tab to compare values rather than flag them, for example scores or sales. Pick a scale under Preview, then optionally set the Minpoint, Midpoint and Maxpoint (a value, number, percent or percentile). Every cell gets a shade between the colors.

Highlight a whole row with a custom formula

Built-in rules only color the cells that meet the condition. To color the whole task row when its status is "Done":

  1. Select the whole data range without the header: A2:D10. (Use A2:D to cover rows you add later.)
  2. Click Format → Conditional formatting. If rules already exist for that range, click Add another rule.
  3. Open Format cells if… and choose Custom formula is (it's at the bottom of the list).
  4. In the Value or formula box, type: =$C2="Done"
  5. Choose a green fill under Formatting style and click Done.

The Google Sheets Conditional format rules panel with Apply to range A2:D10, Format cells if set to Custom formula is, the formula =$C2="Done" in the value box, and a green formatting style

Why the $? Sheets writes the formula for the top-left cell (A2) and adjusts it for every other cell, as if you'd copied it. $C2 keeps the column fixed on C and lets the row change, so A5, B5, C5 and D5 all check C5. Without the $, B2 would check D2 and only part of the row would light up. Use $C$2 (fully locked) only when every cell should look at one input cell. The comparison isn't case-sensitive, so "done" matches too.

More custom formula examples

All of these assume your range starts in row 2.

Conditional formatting based on another cell

In a budget sheet with Actual in column B and Budget in column C, select B2:B and use =B2>C2 to turn every overspend red. Compare against one input cell with =B2>$F$1, where F1 holds your limit.

Highlight overdue dates

Select the due dates (D2:D10) and use: =$D2<TODAY() Blank cells count as zero, which is a date long past, so empty due dates light up too. To skip blanks and tasks that are already finished, use =AND($D2<>"",$D2<TODAY(),$C2<>"Done"). TODAY() recalculates every day, so the highlight moves on its own.

How to highlight duplicates in Google Sheets

Google Sheets has no built-in "duplicate values" condition, so use a formula. Select A2:A and use: =COUNTIF($A:$A,$A2)>1 Every task name that appears more than once is highlighted, including the first copy. To flag only the second and later copies, use =COUNTIF($A$2:$A2,$A2)>1. When you've checked them, Data → Data cleanup → Remove duplicates deletes the extra rows. (Working in Excel? Here's how to remove duplicates in Excel.)

Reference another sheet

Custom formulas can't point to another tab directly. Wrap the reference in INDIRECT, for example =$D2>INDIRECT("Settings!B1").

Several rules: order matters

You can stack as many rules as you like on the same cells, and Sheets checks them from the top of the list down. The first rule that's true decides the cell's format, and the rules below it are ignored for that cell.

That's handy for exceptions. In the tracker, put the green "Done" row rule first and the red =$D2<TODAY() date rule second: if today is November 26, 2026, a finished task due November 20 stays green, and only open tasks that are past due show a red date. To change the order, open Format → Conditional formatting, point to a rule, and drag it up or down by the handle on its left.

Rules also win over colors you applied by hand.

Copy conditional formatting to other cells

  • Paint format: click a formatted cell, click the Paint format (paint roller) button in the toolbar, then select the target cells. The rule comes along with the other formatting.
  • Paste special: copy the cell, then right-click the target → Paste special → Conditional formatting only.
  • Edit the range instead: change Apply to range in the panel. One rule with a bigger range is easier to manage than several copies.

Edit or remove conditional formatting

  1. Select the cells, or the whole sheet (click the box above row 1 or press Ctrl+A / Cmd+A) to see every rule.
  2. Click Format → Conditional formatting.
  3. Click a rule to edit it, or point to it and click the trash icon to remove it.

Format → Clear formatting (Ctrl+\ / Cmd+\) is a blunt tool: it wipes bold, colors, borders and number formats from the selection, and Google doesn't document whether it removes conditional formatting rules as well. Delete rules from the panel so you know they're gone, and check the panel afterward if you used Clear formatting.

Conditional formatting in the Google Sheets app

Android: select the cells, tap Format (the "A" icon), then Conditional formatting. You can add single color and color scale rules, including custom formulas, and remove rules. Labels can differ slightly between app versions.

iPhone and iPad: Google's help says you can see conditional formatting in the app but not create or edit rules. Use Sheets in a browser on a computer for that.

Why conditional formatting isn't working in Google Sheets

The formula works in a cell but not in the rule. A rule's formula must be written for the first cell of Apply to range. If the range starts at A2 but your formula says $C1, every row checks the row above it. Also make sure the formula starts with = and returns TRUE or FALSE, not a number or text.

It colors the wrong rows (one row off). The range and the formula disagree. If Apply to range is A1:D10 (header included), use $C1; if it's A2:D10, use $C2.

Only one column changes color, or everything does. Check the $: use $C2 for whole-row rules, not C2 or $C$2.

A rule seems to be ignored. Another rule higher in the list is already true for those cells. Reorder the rules or tighten the first one.

Rules from copied cells pile up. Copying, pasting and dragging rows copies their rules too, so you end up with many near-identical rules on fragments like A2:D5,A7:D10. Open the panel with the whole sheet selected, delete the extras, and set one clean Apply to range. Use Paste special → Values only when you don't want to bring rules along.

Frequently Asked Questions

How do I highlight a row based on a cell value in Google Sheets? Select the data without headers, go to Format → Conditional formatting, choose Custom formula is, and enter something like =$C2="Done". The $ before the column letter makes the whole row change color.

How do I do conditional formatting based on another cell in Google Sheets? Use a custom formula that points to that cell, such as =B2>C2 to compare each value with the cell beside it, or =B2>$F$1 to compare every row with one input cell.

How do I highlight duplicates in Google Sheets? Select the column, choose Custom formula is, and enter =COUNTIF($A:$A,$A2)>1 (adjust the column letter). There's no built-in duplicates rule in Sheets.

Can I use conditional formatting with a checkbox? Yes. A ticked checkbox is TRUE, so =$E2=TRUE (or just =$E2) colors the row when the box in column E is checked.

Can I filter or sort by conditional formatting color? Yes. Turn on a filter with Data → Create a filter, open the column's filter menu, and use Filter by color or Sort by color. It works with colors set by rules.

Does Excel work the same way? Mostly. Excel calls it Home → Conditional Formatting → New Rule → Use a formula, and unlike Sheets it can apply several matching rules at once. See our guide to conditional formatting in Excel.

Let AI write the formula for you

The hard part of conditional formatting is usually the formula, not the menu. CoreGPT for Sheets sits next to your spreadsheet: describe what you want in plain English, like "total the amounts for the Marketing team" or "a rule that colors the row when the status is Done", and it writes the formula for you. It's free to start.

Try it: CoreGPT for Sheets

Related reading:

Free AI tools

Keep reading