Conditional formatting in Excel for text lets you automatically highlight cells that contain specific words, phrases, or patterns, making it easy to spot important data at a glance. You only need Excel and a worksheet with the text you want to format.
What You'll Need
- Microsoft Excel (Windows or Mac, recent versions)
- A worksheet containing the text data you want to format
Step-by-Step
- Open your Excel workbook and select the range of cells you want to apply conditional formatting to—for example, A2:A100.
- Go to the Home tab on the ribbon.
- In the Styles group, click Conditional Formatting, then choose New Rule.
- In the New Formatting Rule dialog box, select "Format only cells that contain" from the rule type list.
- Under "Format only cells with," set the first dropdown to "Specific Text," the second dropdown to "containing," and in the text box to the right, type the exact word or phrase you want to highlight—for example, "Urgent".
- Click the Format button to choose how matching cells should appear.
- In the Format Cells dialog, go to the Fill tab and pick a background color (like light red) to make the text stand out, then optionally go to the Font tab to change the text color or style (like bold).
- Click OK to close the Format Cells dialog, then click OK again to close the New Formatting Rule dialog and apply the rule.
- Repeat steps 3–8 for additional text values—for example, create another rule for "Complete" with a green fill, or "Pending" with a yellow fill—each as a separate rule.
- To format cells based on text length or partial matches, use "Format only cells that contain" with "Specific Text" and choose "begins with," "ends with," or "not containing" as needed.
- If you want to use a formula for more complex logic (like case-sensitive matching), choose "Use a formula to determine which cells to format" instead, then enter a formula such as =EXACT(A2,"URGENT") and set your format.
- To manage or edit existing rules, go to Home > Conditional Formatting > Manage Rules, where you can view, edit, delete, or change the order of rules.
- Click Apply, then OK to save any changes in the Rules Manager.
Common Mistakes
- Forgetting to select the correct range before creating a rule, which can lead to formatting applying to the wrong cells or the entire sheet.
- Using "containing" without realizing it matches partial text—for example, "cat" will match "category" and "concatenate"; use "equals" or exact formulas if you need whole-word matches.
- Assuming text comparisons are case-sensitive by default—they are not; use the EXACT function in a formula rule if case matters.
- Creating overlapping rules without understanding precedence—Excel applies rules in the order shown in Manage Rules, and later rules can override earlier ones if formats conflict.
- Not clearing old rules before applying new ones, which can cause unexpected formatting due to layered conditions.
- Trying to use wildcards like * or ? in the "Specific Text" field—they are not supported there; use a formula with SEARCH or FIND instead for pattern matching.
Tips
- Use light fill colors for readability—dark colors can make black or default text hard to see.
- When formatting multiple related conditions (like status words), create separate rules for each so you can easily adjust colors or text later.
- To highlight cells that are blank or contain any text, use "Format only cells that contain" and choose "Blanks" or "not containing" with an empty string or a space, depending on your need.
- If you’re working with a large dataset, apply the rule to an entire column (like A:A) so new entries are automatically formatted as you add them.
- Use the "Preview" box in the New Formatting Rule dialog to see how your formatting will look before applying it.
- Copy formatting to other ranges using the Format Painter: select a cell with the rule, click Format Painter, then drag over the target range.
- To remove all conditional formatting from a selection, go to Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells.
Troubleshooting
If your conditional formatting isn’t working as expected, start with these checks:
- Verify the selected range matches where you expect the formatting to appear—too small a range misses cells, too large a range wastes processing and may cause confusion.
- Double-check the rule’s criteria: is the text spelled exactly as it appears in the cells? Are there extra spaces at the start or end? Use TRIM in a helper column if needed to clean data.
- Check rule order in Manage Rules—if a later rule sets a fill color, it can override an earlier rule’s font color, for example.
- Ensure no overlapping rules are causing conflicts; temporarily delete all but one rule to isolate the issue.
- Confirm that the cells aren’t already formatted via table styles or cell styles that might be overriding your conditional formatting—clear direct formatting if needed.
- If using a formula rule, test the formula in a separate cell first to make sure it returns TRUE for the rows you want to format.
- Make sure calculation options are set to Automatic (Formulas > Calculation Options) so rules update when data changes.
- If formatting doesn’t update after editing text, press Ctrl+Alt+F9 to force a full recalculation.
- On Mac, ensure you’re using a recent version of Excel—older versions may have limited conditional formatting features.
- If the Manage Rules dialog shows the rule but it’s not applying, check that the "Stop If True" box isn’t checked unintentionally, which halts further rule processing.
Frequently Asked Questions
Can I conditional format cells based on text in another cell?
Yes—use a formula rule. For example, to highlight cells in column B when the corresponding cell in column A contains "Yes", select B2:B100, use a formula rule with =$A2="Yes", and set your format.
How do I highlight cells that contain any of several different words?
Create a separate rule for each word or phrase, or use a single formula rule like =OR(ISNUMBER(SEARCH("apple",A2)),ISNUMBER(SEARCH("banana",A2))) to check for multiple substrings in one rule.
Why is my conditional formatting not working after I copy and paste new data?
This often happens if the rule’s range doesn’t include the new data. Check Manage Rules to confirm the range (like $A$2:$A$100) covers where you’re pasting, or change it to a full column like $A:$A.
Can I use conditional formatting to change the font color only, not the background?
Absolutely—in the Format Cells dialog for a rule, go to the Font tab and choose a color, then leave the Fill tab set to No Fill or white.
Is there a limit to how many conditional formatting rules I can apply to one range?
Excel allows many rules—hundreds are typically possible—but performance may slow with very complex rules or large datasets. Keep rules as simple as needed.
Do conditional formatting rules work in Excel Online or the mobile app?
Yes, basic conditional formatting (including text-based rules) is supported in Excel Online and the Excel mobile apps, though advanced options like formula rules may be limited or unavailable on mobile.