keepcalculator

06 Numbers and Powers

Use Conditional Formatting In: Excel, Sheets & More

Card No. 06·52138 · Updated · Standard formula, shown below

Conditional formatting is a spreadsheet feature that automatically changes a cell’s appearance—its background color, text color, or borders—based on the cell’s value or a formula you define. You use it by selecting a range of cells, choosing a rule type (like “greater than” or “text contains”), and setting the format to apply when the rule is true. This guide covers where to find it, how to build rules in Microsoft Excel and Google Sheets, and how to avoid the most common mistakes.

Where to Find Conditional Formatting

Conditional formatting lives in the “Home” tab of Excel and the “Format” menu of Google Sheets. In Excel, click Home > Conditional Formatting to open a dropdown with rule types, preset color scales, and the “Manage Rules” dialog. In Google Sheets, go to Format > Conditional formatting, which opens a side panel where you build and edit rules. Both tools allow multiple rules on the same range, and both apply rules in order—the first rule that matches wins unless you check “Stop If True” in Excel.

How Conditional Formatting Works

Every conditional formatting rule has three parts: a range (where it applies), a condition (what triggers it), and a format (what changes). The condition can be a simple comparison like “cell value > 100”, a text match like “text contains ‘overdue'”, or a custom formula that returns TRUE or FALSE. When the condition is met, the format is applied; when it isn’t, the cell stays as is. The key is that the rule is evaluated for each cell in the range, and the cell reference in a formula rule is relative by default—so if you write a rule for cell A1 and apply it to A1:A10, Excel adjusts the reference for each row.

How to Choose the Right Rule Type

  • Highlight cells rules: use when you want to flag specific values, like all sales below target.
  • Top/Bottom rules: use when you want the highest or lowest numbers, like top 10% of test scores.
  • Data bars: use when you want a quick visual bar inside each cell to compare magnitudes.
  • Color scales: use when you want a gradient from low to high, like a heat map of performance.
  • Icon sets: use when you want arrows or traffic lights to indicate status.
  • Custom formula: use when no preset fits, such as highlighting based on another cell’s value or a date in the past.

Common Mistakes and How to Fix Them

The most frequent mistake is using absolute references when you need relative ones. If you write =B2>100 and apply it to A2:A10, every cell checks its own row’s B value—correct. But if you write =$B$2>100, every cell checks only B2, which is rarely what you want. Another common error is applying a rule to the wrong range. Always double-check the “Applies to” box in Excel or the range field in Sheets. A third issue is rule order: if you have a rule that colors all cells red and another that colors cells with “Urgent” yellow, the red rule may override the yellow if it comes first. In Excel, use the “Stop If True” checkbox to control precedence.

Conditional Formatting in Excel vs. Google Sheets

Both tools cover the basics, but there are differences. Excel offers more preset options (like “Text that contains” and “A date occurring”) and a full “Manage Rules” dialog where you can reorder, edit, and delete rules. Google Sheets has a cleaner side panel and makes it easier to see all rules at a glance, but its formula syntax uses the same logic. One notable difference: Excel’s “Stop If True” is per rule, while Sheets applies all matching rules and the last one wins. Also, Excel allows formatting based on a formula that references another sheet, while Sheets requires you to use the INDIRECT function for cross-sheet references.

Performance and Large Datasets

Conditional formatting can slow down a spreadsheet if you apply it to entire columns (e.g., A:A) or use volatile functions like TODAY() in thousands of cells. For large datasets, limit the range to the actual data (e.g., A2:A1000) and avoid whole-column references. Use simple comparison rules instead of complex formulas when possible. In Excel, you can also turn off automatic recalculation while editing, but the best fix is to keep the range tight.

Frequently Asked Questions

How do I highlight a row based on a cell value?

Select the row range (e.g., A2:D10), go to Conditional Formatting > New Rule (Excel) or Format > Conditional formatting (Sheets), choose “Use a formula” (Excel) or “Custom formula is” (Sheets), and enter a formula that references the first row’s key cell with a locked column, like =$B2="Yes". Then set the format and apply.

Why is my conditional formatting not working?

Check three things: the range is correct, the formula is written for the top-left cell of the range, and the cell references are relative where needed. Also, make sure the rule’s format is visible—if you set a font color that matches the background, it looks like nothing happened.

Can I use conditional formatting with text?

Yes. Use the “Text contains” preset or a formula like =ISNUMBER(SEARCH("urgent",A1)) to highlight cells containing specific text. SEARCH is case-insensitive; FIND is case-sensitive.

How do I remove conditional formatting?

In Excel, select the range, go to Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. In Google Sheets, open Format > Conditional formatting, hover over the rule, and click the trash icon.

Can I copy conditional formatting to another range?

Yes. Use Format Painter in both Excel and Sheets. Select the cell with the formatting, click the Format Painter icon, then drag over the new range. This copies all rules, but be aware that relative references will adjust to the new location.

Does conditional formatting work with dates?

Yes. You can use presets like “Date is before” or “Date occurring” in Excel, or a custom formula like =A1<TODAY() to highlight past dates. Remember that dates are stored as numbers, so comparisons work the same as with numbers.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →