Conditional formatting in Excel (XLS and XLSX files) automatically changes a cell’s appearance—fill color, font, borders, or icons—based on rules you set. To apply it, select your cells, go to Home > Conditional Formatting, choose a rule type (like Highlight Cells Rules or Data Bars), and define the condition. For example, to highlight all cells in A1:A10 that are greater than 100, select that range, click Home > Conditional Formatting > Highlight Cells Rules > Greater Than, enter 100, and pick a format.
What Is Conditional Formatting For?
Conditional formatting turns raw numbers into visual signals so patterns and outliers stand out at a glance. It is used for tasks like:
- Flagging overdue invoices (dates older than 30 days).
- Color-scaling sales figures from low to high.
- Adding data bars to show project progress.
- Highlighting duplicate entries in a list.
- Applying icon sets (arrows, traffic lights) to performance metrics.
The feature works on any version of Excel that reads .xls or .xlsx files, including Excel for Microsoft 365, Excel 2021, 2019, and older versions. On a Mac, the menu path is the same: Home > Conditional Formatting.
How to Apply Conditional Formatting Step by Step
Here is the basic workflow for any rule:
- Select the range of cells you want to format (e.g., B2:B20).
- Go to the Home tab.
- Click Conditional Formatting in the Styles group.
- Choose a rule type from the dropdown (e.g., Highlight Cells Rules, Top/Bottom Rules, Data Bars, Color Scales, Icon Sets).
- Set the condition and format in the dialog box that appears.
- Click OK. The rule applies immediately.
To manage existing rules, click Conditional Formatting > Manage Rules. There you can edit, delete, or reorder rules. Rules are evaluated in order of priority; the first matching rule wins unless you check “Stop If True”.
Using Formulas for Custom Rules
When the built-in rules aren’t enough, you can write a formula. This is powerful because the formula can reference other cells or use functions. For example, to highlight entire rows in A2:D20 where the value in column C is greater than 500:
- Select A2:D20 (the whole range to format).
- Click Conditional Formatting > New Rule.
- Choose “Use a formula to determine which cells to format”.
- In the formula box, enter
=$C2>500(note the mixed reference: column C is absolute, row 2 is relative). - Click Format to set a fill color, then OK.
The formula is evaluated for the top-left cell of the selection (A2), and Excel adjusts the relative row references for each row. So for row 3, it checks $C3, and so on. This works in all Excel versions.
Managing and Troubleshooting Rules
Common problems and their fixes:
- Rule not applying to new data: If you add rows below your range, the rule may not extend. Use an Excel Table (Ctrl+T) so rules automatically apply to new rows.
- Wrong cells highlighted: Check the “Applies to” range in Manage Rules. It must match the area you want formatted.
- Rules conflict: When two rules overlap, the one higher in the list wins. Reorder them or check “Stop If True”.
- Formula errors: If your formula returns an error (e.g., #N/A), the rule won’t format. Use IFERROR in the formula to handle errors.
- Performance slow: Too many rules over large ranges can slow Excel. Use fewer, simpler rules and avoid whole-column references like A:A.
Conditional Formatting vs. Manual Formatting
Manual formatting (changing fill color by hand) is static: if the value changes, the color stays. Conditional formatting is dynamic: it recalculates whenever the value changes. That makes it essential for dashboards and live reports. However, conditional formatting cannot be undone with Ctrl+Z if you delete a rule—you must remove the rule via Manage Rules. Also, conditional formatting does not change the cell value, only its appearance.
Costs and Versions
Conditional formatting is included in all desktop versions of Excel—no extra cost. Excel for the web (free with a Microsoft account) supports basic conditional formatting, but some options like icon sets and custom formulas are limited. On Excel for Mac, most features work, but some advanced options (like “Format only top or bottom ranked values”) are available. If you use an older .xls file, conditional formatting works, but complex rules may be lost if you save to a format that doesn’t support them (e.g., CSV).
Frequently Asked Questions
How do I highlight duplicates in Excel?
Select the range, go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values. Choose a format and click OK. This works in all versions.
Can I use conditional formatting with dates?
Yes. For example, to highlight dates older than 30 days, use a formula like =A1<TODAY()-30 (adjust A1 to your top cell). Or use the built-in “A Date Occurring” rule.
Why is my conditional formatting not working when I copy cells?
When you copy and paste cells, the formatting may be overwritten. Use Paste Special > Values to paste only values, or copy the rule itself via Manage Rules. Also, ensure the “Applies to” range includes the pasted area.
How do I remove conditional formatting?
Select the range, go to Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. Or use Manage Rules to delete specific rules.
Can I use conditional formatting to highlight a row based on a cell value?
Yes, use a formula rule. Select the entire row range, and use a formula like =$C2>100 (adjust column and threshold). Make sure the row reference is relative (no $ before the row number).
Does conditional formatting work in Google Sheets?
Yes, but the menu path is different: Format > Conditional formatting. The logic is similar, but formulas use different syntax (e.g., no $ for absolute references unless you add them manually).
Related
- What Is a 5 Year Balloon? Loan & Mortgage Term
- Count Rows in MySQL: The 5 Best Ways
- How to Sum All Subtotals in Excel (3 Ways)
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel and Numbers Compatibility: What WorksExcel and Apple Numbers are compatible for basic data exchange, but not fully: Numbers can open Excel files…
- How to Group Rows in Excel and Collapse Them EasilyTo group rows beneath a heading in Excel, select the detail rows by their row numbers, then choose…
- Excel Print Area: Set It, Clear It, and Print AutomaticallyNo—Excel does not automatically expand a worksheet’s print area when you add data; a print area is a…
- Power Query Merge: How to Join Tables in Microsoft ExcelPower Query Merge joins rows from two queries using one or more matching columns. In Excel, open the…
- How to Calculate Subtotal in Google SheetsTo calculate a subtotal in Google Sheets, use the SUBTOTAL function. It lets you sum, average, count, or…
- Outlook Email Signature: How to Create and Set It UpTo create an email signature in Outlook, open the signature settings for your version, write and format your…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.