Ravindra BagaleCourses & study guides मराठी Track your progress

2. Data Entry Tools

2.8 Formula-based Conditional Formatting

Formula-based conditional formatting with example — in 30 seconds

What: A formula rule colours the whole row when your formula returns TRUE for that row.

Why: Colouring only the Status cell is easy to miss. A full red row makes cancelled orders jump out.

Tiny example: In the mini sheet, Status is column I. The rule =$I2="Cancelled" paints rows BLK-1004 and BLK-1009.

First look at the data (before → after):

Formula-based conditional formatting with example: before and after tables, fictional FreshGo Maharashtra data

Expected result — Rows that turn red (highlighted)

A: Order ID C: City I: Status
BLK-1001 Pune Delivered
BLK-1004 Nagpur Cancelled
AMN-1008 Sambhaji Nagar Returned
BLK-1009 Pune Cancelled

About this data: Teaching sample for a fictional shop “BrightLedger Finance”. Figures and names (e.g. Rohan Patil) are made up for this lesson on formula based conditional formatting.

Before table and formula as text

Before — Mini sheet rows (no colour yet)

A: Order ID C: City I: Status
BLK-1001 Pune Delivered
BLK-1004 Nagpur Cancelled
AMN-1008 Sambhaji Nagar Returned
BLK-1009 Pune Cancelled

About this data: Demo table only — not real customer or company data. Built to practise formula based conditional formatting.

Formula / click path

Select A2:I11 › Home › Conditional Formatting › New Rule
Use a formula: =$I2="Cancelled"  › Format › Fill: light red

Do it step by step:

  1. Select the data A2:I11. Start from row 2, not the header.
  2. Click Home › Conditional Formatting › New Rule.
  3. Choose Use a formula to determine which cells to format.
  4. Type =$I2="Cancelled". The $ locks column I; the row stays free.
  5. Click Format › Fill, pick light red, then OK twice.

For rules that depend on another column or a whole row, use a formula. The formula must return TRUE/FALSE and is written for the top-left cell of the selection.

Steps in Excel – highlight the entire row of cancelled orders

  1. Select A2:O5000 (whole data, without header).
  2. Home › Styles › Conditional Formatting › New Rule… › Use a formula to determine which cells to format.
  3. Formula: =$N2="Cancelled" (column fixed with $, row relative).
  4. Format… › Fill light grey, font strikethrough › OK › OK.

More formula rules on our data:

Goal Formula (top-left cell A2)
Late Pune deliveries =AND($D2="Pune",$M2>15)
Weekend orders =WEEKDAY($B2,2)>5
Orders in Diwali week (fictional dates) =AND($B2>=DATE(2026,11,6),$B2<=DATE(2026,11,12))
Every alternate row (zebra) =MOD(ROW(),2)=0
Value above its city's average =$K2>AVERAGEIF($D:$D,$D2,$K:$K)
Row matches a selected city in cell R1 =$D2=$R$1

About this data: Made-up rows so you can copy the pattern for formula based conditional formatting. Currencies may use ₹, £, € or $.

Ravindra Bagale's Tip

The most common mistake in a formula rule is putting the $ in the wrong place. To colour the whole row, lock the column with $ ($N2), not the row. If you write $N$2, every row depends only on row 2 and the whole sheet turns one colour. Always write the formula for the first row of the selected range.

Practice task

Highlight whole rows where Platform is MarketRush and Amount > ₹500. Then make a "selected city" cell R1 with a drop-down and highlight rows of that city only.

Loading practice tasks...

  1. Pass or fail (Easy): "Pass" if B2 is at least 40, else "Fail".
  2. Total (Easy): B2 plus C2.
  3. Passed score 1 (Easy): How many in B2:B11 are 40 or more?
  4. Passed both (Medium): TRUE if B3 and C3 are both at least 40.
  5. Passed either (Medium): TRUE if B4 or C4 is at least 75.
  6. Grade (Medium): Grade for the average of B2:C2: "A" 75+, "B" 60+, "C" 40+, else "F".
  7. Eligible (Medium): "Eligible" if D5 is at least 75 and B5 at least 40, else "Not eligible".
  8. Count passed both (Hard): How many have both scores at least 40?
  9. Pass percentage (Hard): Share passing score 1, rounded to 2 decimals.
  10. Nested IF band (Hard): "High" if C6 ≥ 75, "Mid" if ≥ 50, else "Low", using nested IF.
  11. Top scorer (Hard): Name with the highest score 1.

Quick revision cards

Three standalone cards. Each one explains the idea with its own example. Scan the QR to open this lesson.

Revision card 1: What is Formula Based Conditional Formatting?
Card 1: What is Formula Based Conditional Formatting? · Download PNG
Revision card 2: Tiny example — Formula Based Conditional Formatting
Card 2: Tiny example — Formula Based Conditional Formatting · Download PNG
Revision card 3: Checklist — Formula Based Conditional Formatting
Card 3: Checklist — Formula Based Conditional Formatting · Download PNG