Tabellab

Highlight Cell Rules: Greater Than, Between, Text Contains

Lesson 1 of 20Lab

All lessons

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — $9.90
Read first

In Excel

  • Select B2:B21, Home > Conditional Formatting > Highlight Cells Rules > Greater Than, type 120000 (or click $D$23 to keep the threshold in a cell), choose Green Fill with Dark Green Text.
  • Between asks for two values; Text that Contains for a word. Custom Format… in the colour list lets you pick any fill, font or border.
  • Never include the header or a total row in the range – a total is always "greater than" and steals the colour.
  • Remove rules with Conditional Formatting > Clear Rules (selected cells or entire sheet); edit them in Manage Rules.
Loading the spreadsheet…

Why conditional formatting is the fastest way to read a report

Picture a Monday morning. The Q3 report of Brightwater Coffee Co., a fictional chain of 20 cafés, lands in your inbox: store names, sales, targets, percentage changes, guest scores and a column of notes from the area managers. Your boss wants three answers before lunch. Which stores are the big sellers? Which ones are close to target and could tip either way? And which stores have building work coming up? You could read 140 numbers one by one, or you could let Excel colour the answers for you.

That is exactly what conditional formatting does. It applies a fill, font colour, border or icon to a cell only when a rule is true. The rule is checked again every time a number changes, so a report you colour today still tells the truth next quarter when you paste in new figures. A cell you paint by hand cannot do that: it stays green even after the store has fallen behind, and that kind of stale colour is how people make bad decisions from good data.

This free lesson is for anyone who builds or reads tables in Excel: analysts, store and project managers, finance teams, teachers grading results, or students who just want their spreadsheets to make sense at a glance. You do not need any formulas beyond a simple division. By the end you will know how the three most useful Highlight Cells Rules work (Greater Than, Between and Text that Contains), how to point a rule at a threshold cell instead of a hard-coded number, how to count what you coloured with COUNTIFS, and how to avoid the classic traps that make a rule colour nothing or the wrong thing. The lab above uses the same Brightwater data, so you can try every step right on this page.

The core idea: a rule is a question with a colour attached

Every conditional formatting rule has three parts. First, the range it applies to, for example B2:B21. Second, a test that Excel runs for each cell in that range and that returns TRUE or FALSE, for example "is the value greater than 120,000?". Third, a format that Excel shows only where the test is TRUE. Nothing about the cell value changes. The number 156,200 is still 156,200; it just wears a green fill while the test holds.

Every rule = range + test + formatApplies to=$B$2:$B$21which cellsTestCell Value > $D$23TRUE or FALSE per cellFormatGreen fill, dark textused only when TRUERecalculated after every changeAirport 156,200 > 120,000: TRUE, green. Southbank 120,000 > 120,000: FALSE, no colour.Change D23 to 100,000 and four more cafés turn green at once.
The anatomy of a rule. Excel tests every cell of the range separately and shows the format only where the test returns TRUE.

The Highlight Cells Rules menu is the friendliest entry point because it writes the test for you. You pick a comparison, type a value and choose a colour. The comparisons behave exactly like the operators you know from formulas, and the details matter:

  • Greater Than means strictly greater. A rule "greater than 120,000" colours Airport (156,200) but not Southbank, which sold exactly 120,000. If you want "120,000 or more", use a formula rule with >= or set the threshold to 119,999.99.
  • Less Than is the mirror image and is also strict.
  • Between includes both ends. "Between 0.95 and 1.05" colours a store at exactly 95% and one at exactly 105%.
  • Equal To needs the whole cell content to match. It is useful for codes and statuses such as "Closed", but not for finding a word inside a longer note.
  • Text that Contains looks for the text anywhere in the cell and ignores upper and lower case. "refit" matches Refit planned Nov, REFIT planned Jan and refit quote received.
  • A Date Occurring and Duplicate Values complete the menu. Duplicates get a lesson of their own later in this course.

One more concept turns a pretty table into a reliable tool: the threshold cell. Instead of typing 120000 into the rule, you can click a cell such as D23 while the dialog is open. Excel then stores the reference =$D$23. Change the value in D23 and every coloured cell updates at once, and anybody who opens the file can see which threshold is in use. Hidden numbers inside rules are one of the most common reasons why two colleagues read the same report differently.

Worked example: Brightwater's Q3 store report

Here is the data from the lab. Column D is the only thing you calculate: % of target = sales ÷ target. Station sold 88,900 against a target of 90,000, so =B5/C5 returns 0.9878, which Excel shows as 98.8% once the cell has a percentage format (Ctrl+Shift+%). The last column lists which of the three rules from the lab colour each row. All names and numbers are fictional and chosen for practice.

StoreSales Q3Target Q3Formula in D% of targetRules that fire
Harbor128,400120,000=B2/C2107.0%green (sales), orange (refit)
Old Town96,300105,000=B3/C391.7%–
Riverside141,750130,000=B4/C4109.0%green (sales)
Station88,90090,000=B5/C598.8%yellow (band), orange (refit)
Campus72,60085,000=B6/C685.4%–
Airport156,200140,000=B7/C7111.6%green (sales)
Marina104,500100,000=B8/C8104.5%yellow (band)
Hillcrest61,80075,000=B9/C982.4%orange (refit)
Mill Lane119,300115,000=B10/C10103.7%yellow (band)
Northgate99,000110,000=B11/C1190.0%–
Lakeside124,300136,000=B12/C1291.4%green (sales)
Westpark99,750105,000=B13/C1395.0%yellow (band)
Cathedral126,000120,000=B14/C14105.0%green (sales), yellow (band)
Canal Street83,40080,000=B15/C15104.2%yellow (band)
Southbank120,000112,000=B16/C16107.1%–
Parkside67,90070,000=B17/C1797.0%yellow (band)
Seafront132,800125,000=B18/C18106.2%green (sales)
Tech Park91,200100,000=B19/C1991.2%–
Museum Quarter78,50072,000=B20/C20109.0%–
Eastgate108,900115,000=B21/C2194.7%orange (refit)

Read the last column and the story of the quarter appears. Six cafés sold more than 120,000: Harbor, Riverside, Airport, Lakeside, Cathedral and Seafront. Southbank, at exactly 120,000, is not among them, because greater than is strict. Seven stores sit inside the yellow 95%–105% band: Station, Marina, Mill Lane, Westpark, Cathedral, Canal Street and Parkside. Notice Westpark at exactly 95.0% and Cathedral at exactly 105.0%: both are included because Between counts its end points. Eastgate, at 94.7%, misses the band by a hair, which is precisely the kind of store a manager wants to know about, and a good reason to keep the band limits in cells you can adjust. Four notes contain "refit" in some form, and the case-insensitive search finds all of them.

Now the colours can be counted. Excel has no built-in worksheet function that counts cells by fill colour, and you do not need one: count the condition instead of the colour. With the band limits in D24 and D25, the formula =COUNTIFS(D2:D21,">="&D24,D2:D21,"<="&D25) returns 7, the same seven yellow cells. The & glues the operator to the cell value, so the criterion becomes ">=0.95". Use >= and <= to match the inclusive behaviour of Between; with > and < you would lose Westpark and Cathedral and get 5.

% of target, Q3 (axis starts at 80%)Airport111.6%Riverside109.0%Museum Quarter109.0%Southbank107.1%Harbor107.0%Seafront106.2%Cathedral105.0%Marina104.5%Canal Street104.2%Mill Lane103.7%Station98.8%Parkside97.0%Westpark95.0%Eastgate94.7%Old Town91.7%Lakeside91.4%Tech Park91.2%Northgate90.0%Campus85.4%Hillcrest82.4%80%85%90%95%100%105%110%115%
The lab's ranking chart, drawn here with the same three bands: mint above 105%, yellow inside 95%–105%, peach below 95%. Bars with a dark outline are the big sellers above 120,000 in sales.

The bar chart shows something the colours in column B alone hide. Lakeside has a dark outline, so it is a big seller, yet its bar is peach: 124,300 in sales against a target of 136,000 is only 91.4%. A manager scanning column B sees a healthy green cell and moves on. A manager who compares the two rules sees that Lakeside is 11,700 below plan, the only big seller outside the band on the wrong side, and the café worth visiting first. That is the final question in the lab.

Sales vs % of target: one colour answers one questionsales > 120,000 (green rule)band above: 95%–105% (yellow rule)60k80k100k120k140k160k80%90%100%110%Sales Q3 (USD)AirportHillcrestLakesideSouthbank
Each dot is one café. The green zone is the "greater than 120,000" rule, the yellow strip is the 95%–105% band. Lakeside (peach) is the only big seller below 95% of its target.

This is the most important lesson about conditional formatting, and it is why the first lesson of this course ends with a thinking question instead of another rule: a colour answers only the question you asked it. "Big seller" and "on target" are different questions, so they need different rules, and the insight lives where they disagree.

How to do it in Excel, step by step

The steps below use the Windows ribbon in Microsoft 365; Excel for Mac and Excel for the web use the same menu names. Open a blank workbook and type or paste the Brightwater table, or simply work in the lab above, which follows the same logic.

  1. Calculate % of target. Click D2, type =B2/C2 and press Enter. Select D2 again and double-click the fill handle (the small square in the bottom-right corner) to copy the formula down to D21. Press Ctrl+Shift+% to show percentages, then Home > Number > Increase Decimal once for one decimal place.
  2. Select only the data. Click B2 and press Ctrl+Shift+↓ to extend the selection to the last filled row. Check the Name Box: it should read B2:B21. Leave the header and any total row out.
  3. Add the "big seller" rule. Go to Home > Conditional Formatting > Highlight Cells Rules > Greater Than…. In the box on the left, click cell D23 (which holds 120000) so the box shows =$D$23. In the list on the right, choose Green Fill with Dark Green Text and click OK.
  4. Add the near-target band. Select D2:D21, then Home > Conditional Formatting > Highlight Cells Rules > Between…. Click D24 for the first value and D25 for the second (or type 95% and 105%; Excel converts them to 0.95 and 1.05). Choose Yellow Fill with Dark Yellow Text.
  5. Flag the refit notes. Select G2:G21, then Highlight Cells Rules > Text that Contains…, type refit and pick Custom Format… if you want an orange fill (Fill tab, choose a colour, OK).
  6. Count the band with a formula. In D26 type =COUNTIFS(D2:D21,">="&D24,D2:D21,"<="&D25). The result must equal the number of yellow cells; if it does not, one of the two is wrong.
  7. Rank the stores in a chart. Select A1:A21, hold Ctrl and select D1:D21. Choose Insert > Charts > Insert Column or Bar Chart > Clustered Bar. To show the largest bar at the top, sort the data by column D before charting (Data > Sort, Smallest to Largest, because a bar chart draws the first row at the bottom), or keep the order and tick Categories in reverse order in the vertical axis options.
  8. Review and edit your rules. Open Home > Conditional Formatting > Manage Rules… and set Show formatting rules for to This Worksheet. Here you can change a threshold, the range in Applies to, the format, or the order of rules. To remove rules, use Clear Rules > Clear Rules from Selected Cells or from Entire Sheet.
Shortcut fans: select a range and press Ctrl+Q to open the Quick Analysis menu, whose Formatting tab offers Greater Than, Text Contains, Duplicate Values, data bars and colour scales in two clicks. To find every cell that carries a rule, press F5, click Special… and choose Conditional formats.
You can also filter by the colour a rule produced: turn on Data > Filter, open the arrow in the column header and choose Filter by Color. It is a fast way to list only the yellow stores, while the COUNTIFS formula remains the reliable way to count them.

Excel table of café sales with green, yellow and orange conditional formatting highlights
Conditional formatting turns a wall of numbers into a report you can read in seconds. This course builds it rule by rule on one café chain's data.

Common mistakes and how to spot them

Conditional formatting rarely shows an error message. When something goes wrong, the rule simply colours nothing, colours everything, or colours the wrong cells. These are the mistakes behind almost all of those cases, with the quickest way to catch each one.

  • Typing 95 instead of 0.95. A percentage cell stores a decimal: 98.8% is 0.988. A rule "between 95 and 105" therefore colours nothing. Spot it: if a percentage rule never fires, open Manage Rules and look at the values. Type 95% with the percent sign or use 0.95.
  • Including the header or a total row. A total of 2.1 million is always "greater than 120,000", so it grabs a colour and, for relative rules like Top 10% or Above Average, it shifts the result for every other cell. Spot it: check the Applies to box in Manage Rules; it should stop at the last data row.
  • Hard-coding a threshold that changes. If the big-seller limit moves to 130,000 next year, a rule with 120000 typed inside keeps colouring the old answer. Point the rule at a labelled input cell such as =$D$23.
  • Using Equal To for words. Equal To "refit" matches only a cell that contains exactly "refit" and nothing else. Use Text that Contains for a word inside a note.
  • Numbers stored as text. Values imported from another system sometimes arrive as text (often left-aligned with a small green triangle). A numeric rule ignores them. Spot it: =ISNUMBER(B2) returns FALSE. Fix it with Data > Text to Columns > Finish or the warning icon's Convert to Number.
  • Copying cells and multiplying rules. Each paste of formatted cells can add a copy of the rule, and after a few weeks Manage Rules lists dozens of near-identical entries. Spot it: set Manage Rules to This Worksheet and merge the duplicates into one rule with a wider Applies to range. Use Paste Special > Values when you only want the numbers.
  • Trusting one colour too much. As Lakeside shows, a green sales cell can belong to a store that is missing its target. Spot it: for every rule, ask which question it answers and whether a second rule or a ratio column tells a different story.
  • Colour as the only signal. Around one in twelve men has some form of colour vision deficiency, and red versus green is the hardest pair. Pair colour with a number, a status word or an icon, and choose fills that differ in lightness as well as hue.

Quick reference: functions, menus and shortcuts from this lesson

ItemWhere / syntaxWhat it does
Greater Than / Less ThanHome > Conditional Formatting > Highlight Cells RulesColours values strictly above / below a number or a cell
BetweenHighlight Cells Rules > Between…Colours values inside a range, both ends included
Text that ContainsHighlight Cells Rules > Text that Contains…Finds text anywhere in the cell, not case-sensitive
Manage RulesConditional Formatting > Manage Rules…Edit, reorder, delete rules; change Applies to
Clear RulesConditional Formatting > Clear RulesRemoves rules from the selection or the whole sheet
Quick AnalysisCtrl+QCommon rules, data bars and colour scales in two clicks
Go To SpecialF5 > Special > Conditional formatsSelects every cell that has a rule
Percent formatCtrl+Shift+%Shows 0.988 as 99%
Select to last rowCtrl+Shift+↓Extends a selection to the end of the data
COUNTIFS=COUNTIFS(range,">="&low,range,"<="&high)Counts the cells a Between rule colours
ISNUMBER=ISNUMBER(B2)Checks that a value is a real number, not text

Real-world uses

Highlight rules are small, but they show up in almost every job that involves a spreadsheet. A few concrete examples, with the rule you would use:

  • Sales and retail reporting. Colour stores, products or reps above a sales threshold green and ratios inside a "watch" band yellow, exactly like the Brightwater report. Keep both thresholds in input cells so the regional manager can adjust them without editing rules.
  • Budget versus actual. Calculate actual ÷ budget for each cost line and highlight anything greater than 1.1 (10% over budget) in peach. Finance teams use this to decide which lines need a comment in the monthly pack.
  • Stock and inventory. A Less Than rule pointed at a reorder-level cell flags every item that needs ordering. When a delivery arrives and the quantity rises, the colour disappears on its own.
  • Project and ticket lists. Text that Contains "blocked" or "urgent" on a status or comment column surfaces the rows that need attention, whatever capitalisation people used.
  • Grades and assessments. Teachers often highlight scores between two grade boundaries to find students who are close to the next grade, using Between with boundary cells so the same sheet works for every test.

What you will build in the rest of this course

This first lesson covered the simplest rules. The remaining 19 labs use the same café chain and build a complete, self-updating reporting toolkit. Each lab gives you real data, step-by-step tasks and an instant check of every rule you create.

Lesson 2: Top/Bottom Rules & Above/Below Average. Let Excel find the leaders by itself. You colour Brightwater's three best-selling products with a Top 3 rule and every product whose margin is below the average, and you learn which line each rule actually draws, so you can reproduce it with a formula when someone asks "why is this one coloured?".

Lesson 3: Duplicate & Unique Values. Twelve loyalty-card sign-ups, but how many real customers? You colour repeated email addresses, count the unique people behind them and spot the stores with only one sign-up. It is the same skill you need to clean any customer, supplier or product list before you trust a count.

Lesson 4: Colour Scales: Two Heat Maps. Turn two store-by-month grids into heat maps: total sales, where high is good, and average wait time, where high is bad. You choose the right direction of the colour scale for each and see seasonal patterns that rows of numbers hide.

Lesson 5: Data Bars: In-Cell Bar Charts. Put a small bar chart inside each cell. You total the online-shop revenue, work out each product's share and add data bars to both columns, without letting the total row flatten every other bar. A favourite trick for dashboards and one-page summaries.

Lesson 6: Formula-Based Rules: Overdue Invoices & Banded Rows. Go beyond the menu with your own formulas. You test an overdue-invoice formula in a helper column, turn it into a rule that colours the whole row, add banded rows and total what is late. Formula rules are where conditional formatting becomes truly flexible.

Lesson 7: Combining Rules & Rule Order: One Status, Three Colours. Real reports have overlapping rules. You build one status formula, Red beats Amber beats Green, colour a store scorecard and learn how rule order and "Stop If True" decide which colour wins, so your traffic lights never contradict each other.

Lesson 8: Mid-course project: KPI Table with Sparklines, Rules & a Chart. Lab 8 puts it all together in a half-year KPI table: the change from July to December, a sparkline per store, red for the stores that shrank and a sorted bar chart of the change. It is a template you can reuse for your own monthly reporting.

Finish all 20 labs and pass the final exam to earn the Tabellab Certified Conditional Formatting User certificate.

Summary

Conditional formatting colours a cell only while a rule is true, so your report stays correct when the data changes. Greater Than is strict, Between includes both ends, and Text that Contains ignores case. Store thresholds in labelled cells, keep headers and totals out of the range, enter percentages as decimals, and confirm what the colours show with a COUNTIFS formula. Above all, remember that each colour answers one question: Lakeside is a big seller and still the store furthest behind its target.

Now scroll up to the lab and try it yourself: calculate the % of target, add the three highlight rules, chart the ranking and find the store you would visit first. The Coach checks every step as you go, and it takes about 20 minutes.

Frequently asked questions

How do I highlight cells greater than a value in Excel?

Select the cells, go to Home > Conditional Formatting > Highlight Cells Rules > Greater Than, type the value or click a cell that holds it, choose a format and click OK. Greater Than is strict, so a cell equal to the value is not coloured.

Does the Between rule in conditional formatting include the end values?

Yes. Between colours values equal to the lower and the upper limit as well. To count the same cells with a formula, use COUNTIFS with >= and <=.

Why is my percentage conditional formatting rule not working?

Percentages are stored as decimals, so 95% is 0.95. A rule typed as between 95 and 105 colours nothing; type 95% and 105% or 0.95 and 1.05 instead.

Is Text that Contains case-sensitive?

No. Text that Contains finds the text anywhere in the cell and ignores upper and lower case, so refit matches Refit and REFIT. For a case-sensitive test, use a formula rule with FIND.

Can I use a cell reference instead of a fixed number in a conditional formatting rule?

Yes. While the rule dialog is open, click the cell that holds the threshold and Excel stores an absolute reference such as =$D$23. Changing that cell updates every coloured cell at once.

Can Excel count cells by their conditional formatting colour?

There is no built-in worksheet function that counts by fill colour. Count the condition behind the colour instead, for example with COUNTIF or COUNTIFS using the same threshold cells as the rule.

Keep going: Excel Conditional Formatting: Highlight Rules, Data Bars & Heat Maps

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.

  1. Top/Bottom Rules & Above/Below Average
  2. Duplicate & Unique Values
  3. Colour Scales: Two Heat Maps
  4. Data Bars: In-Cell Bar Charts
  5. Formula-Based Rules: Overdue Invoices & Banded Rows
  6. Combining Rules & Rule Order: One Status, Three Colours
  7. Mid-course project: KPI Table with Sparklines, Rules & a Chart
  8. Icon Sets: Arrows & Traffic Lights with Fixed Thresholds
  9. Outliers by Formula: Standard Deviation Bands & z-Scores
  10. Spotlight Rules: Highlight Rows from a Selector Cell
  11. Date Rules: Overdue, Due Soon & Fixed As-of Dates
  12. Mixed References in Rules: Best Day per Store, Weakest Store per Day & Weekends
  13. Plausibility Checks: Blanks, Totals That Don't Add Up & Impossible Values
  14. Second Dataset: Supplier Scorecard with Late & Short Deliveries
  15. Project: Regional Store Dashboard with Icons, Ranks & a Scatter Chart
  16. Text Rules from a Keyword List: Flag Complaints & Codes That Begin With …
  17. Second Dataset: A Staff Rota Coverage Grid with Understaffed Hours
  18. Dynamic Thresholds: Quartile Rules with PERCENTILE & a Week-over-Week Drop
  19. Final Project: Menu Engineering Matrix with Class Colours & a Scatter Chart

Buy course — $9.90 See the full course