Skip to content

Conditional Formatting in Excel

Color cells automatically by their values: highlight low stock, add data bars and color scales, and format whole rows with a formula. Practice step by step.

  • Free, no sign-up
  • No upload – files stay on your device
  • Phone, tablet and computer
Loading the spreadsheet …

Conditional formatting in Excel colors cells automatically based on their values: low stock in red, top sellers with a long bar, margins from red to green. When a value changes, the color changes with it. Above, you format the inventory list of a small coffee roaster step by step, ending with a rule that colors whole rows.

How conditional formatting in Excel works

A rule always has two parts: a range it applies to and a condition with a format. Every cell in the range is checked on its own. In Excel and in the Spreadsheet Editor, you find the rules under Home → Conditional Formatting:

Rule type Example Good for
Highlight cells: greater than, less than, between, equal to Stock less than 20 Thresholds and limits
Text that contains, dates Status contains “late” Lists and deadlines
Duplicate values Emails that occur twice Checking lists before cleaning them up
Top/bottom rules Top 3 sales Rankings
Data bars Bar length by units sold Comparing sizes at a glance
Color scales Red – Yellow – Green by margin Spotting highs and lows
Formula =$B2<$C2 Whole rows, comparisons between columns

Practice right here

The list above shows 12 coffees with stock, reorder point, units sold in October and margin. Select the range named in each task, add the rule and click Check:

  1. Highlight stock below 20 in red with “Less Than”.
  2. Add data bars to the units sold.
  3. Color the margin with the Red – Yellow – Green color scale.
  4. Show the whole row in red when stock is below its own reorder point.

If a rule covers the wrong range or the colors are reversed, the check tells you what to change.

Formatting whole rows with a formula

Quick rules compare each cell with a fixed value. To color a whole row depending on one column, or to compare two columns, use a formula rule:

  1. Select the entire data range without headers, such as A2:E13.
  2. Choose Conditional Formatting → New Rule and the rule type “Use a formula to determine which cells to format”.
  3. Write the formula for the top-left cell of the range: =$B2<$C2.
  4. Choose a format and confirm.

The dollar sign before B and C locks the columns, so every cell in a row checks the same stock level. The row number has no dollar sign, so it moves down with each row. In the practice data, five coffees end up in red.

Note: In the Spreadsheet Editor, a fill color from another rule covers data bars and color scales in the same cell. For row rules, use a font color instead, as in task 4.

Common mistakes

  • Only the first column is colored: the dollar sign before the column letter is missing, as in =B2<C2.
  • Every row looks like row 2: a dollar sign before the row number, as in =$B$2<$C$2, locks the row too.
  • Formula refers to the wrong row: it must match the first row of the selected range.
  • Rules overlap: several rules can apply to one cell. Under Manage Rules you see all of them and can delete the ones you don’t need.
  • Colors reversed: in a color scale, the first color is for the lowest value.

Frequently asked questions

Why does the yellow in my color scale sit somewhere else in Excel?

The Spreadsheet Editor puts the middle color exactly halfway between the smallest and largest value; for margins from 31% to 55%, that’s 43%. Excel uses the 50th percentile by default, which is 44.5% in the practice data.

How do I highlight overdue dates?

Use a formula rule such as =$D2<TODAY(). It works in both programs and updates every day. The Spreadsheet Editor also has a ready-made date rule for dates before today.

Are the rules kept when I save as .xlsx?

From the Spreadsheet Editor, simple rules (greater than, less than, equal to, between, text contains) are saved. Data bars, color scales and formula rules are not.

Are icon sets available?

Excel offers icon sets such as traffic lights and arrows. The Spreadsheet Editor doesn’t.

Related lessons: make repeated entries visible before you remove duplicates, or count the colored cases with COUNTIF.

Microsoft Excel is a trademark of Microsoft Corporation. The Spreadsheet Editor is not affiliated with Microsoft.