Use Conditional Formatting in Excel with Formulas to Highlight Errors, Blanks and Duplicates
by Avantix Learning Team | Updated September 15, 2023
Applies to: Microsoft® Excel® 2010, 2013, 2016, 2019, 2021 and 365 (Windows)
Conditional formatting is a great tool in Excel and if you combine it with formulas, you can do some amazing things. In this article, we'll use some simple examples to show the power of conditional formatting.
Conditional Formatting appears on the Home tab in the Ribbon in the Styles group.
You can apply conditional formatting using a formula and a new rule. Below is a sample of a rule with a formula:
Recommended article: 15 Microsoft Excel Keyboard Shortcuts to Speed Up Formatting
Do you want to learn more about Excel? Check out our virtual classroom or in-person classroom Excel courses >
In this article, we'll use formulas in conditional formatting rules but you can also apply some conditional formatting using built-in formatting rules.
Highlight errors using conditional formatting
You can use conditional formatting to highlight errors in a range of cells.
In example below, there are errors in column C:
To highlight the errors using conditional formatting:
- Select the range of cells in a column where some of the cells contain errors. In this example, select C2 to C10 .
- Click the Home tab in the Ribbon and select Conditional Formatting in the Styles group. A drop-down menu appears.
- Select New Rule from the drop-down menu. A dialog box appears.
- Click Use a formula to determine which cells to format. In the formula box, enter =ISERROR(active cell reference). In this example, enter =ISERROR(C2). Enter the formula for the first cell in the range. Excel uses relative referencing by default so the formula will be copied down and adjusted for the remaining cells.
- Click Format. A dialog box appears.
- Click the Fill tab and select a light fill.
- Click OK twice.
Highlight blanks using conditional formatting
You can use conditional formatting to highlight blanks in a range of cells.
In the example below, there are blanks in column C:
To highlight the blanks using conditional formatting:
- Select the range of cells in the column where some of the cells contain blanks. In this example, select C2 to C10.
- Click the Home tab in the Ribbon and select Conditional Formatting in the Styles group. A drop-down menu appears.
- Select New Rule from the menu. A dialog box appears.
- Click Use a formula to determine which cells to format. In the formula box, enter =ISBLANK(active cell reference). In this example, enter =ISBLANK(C2). Enter the formula for the first cell in the range. Excel uses relative referencing by default so the formula will be copied down and adjusted for the remaining cells.
- Click Format. A dialog box appears.
- Click the Fill tab and select a light fill.
- Click OK twice.
Highlight duplicates using conditional formatting
You can also use conditional formatting to highlight duplicates in a range of cells.
In the example below, there are duplicates in column A:
To apply conditional formatting to highlight the duplicates:
- Select the range of cells in the column where some of the cells contain duplicates. In this example, select A2 to A10.
- Click the Home tab in the Ribbon and select Conditional Formatting in the Styles group. A drop-down menu appears.
- Select New Rule from the menu. A dialog box appears.
- Click Use a formula to determine which cells to format. In the formula box, enter =COUNTIF(absolute range,cell containing criteria)>1. In this example, enter =COUNTIF($A$2:$A$10,A2)>1. Enter the formula for the range of cells using absolute referencing (since this range should not change) and for the cell holding the criteria using relative referencing and refer to the active cell. Excel will then copy the formula down and adjust for the remaining cells.
- Click Format. A dialog box appears.
- Click the Fill tab and select a light fill.
- Click OK twice.
These are just a few examples of conditional formatting with formulas. You can use all kinds of other formulas in rules to format cells.
Subscribe to get more articles like this one
Did you find this article helpful? If you would like to receive new articles, JOIN our email list.
More resources
How to Use Flash Fill in Excel (4 Ways with Shortcuts)
How to Freeze Row and Column Headings in Excel Worksheets
3 Excel Strikethrough Shortcuts to Cross Out Text or Values in Cells
How to Replace Blank Cells with a Value from the Cell Above in Excel
Use Conditional Formatting in Excel to Highlight Dates Before Today (3 Ways)
Related courses
Microsoft Excel: Intermediate / Advanced
Microsoft Excel: Data Analysis with Functions, Dashboards and What-If Analysis Tools
Microsoft Excel: Introduction to Visual Basic for Applications (VBA)
Our instructor-led courses are delivered in virtual classroom format or at our downtown Toronto location at 18 King Street East, Suite 1400, Toronto, Ontario, Canada (some in-person classroom courses may also be delivered at an alternate downtown Toronto location). Contact us at info@avantixlearning.ca if you'd like to arrange custom instructor-led virtual classroom or onsite training on a date that's convenient for you.
Copyright 2024 Avantix® Learning
You may also like
What is Power Query in Excel?
Power Query in Excel is a powerful data transformation tool that allows you to import data from many different sources and then extract, clean, and transform the data. You will then be able to load the data into Excel or Power BI and perform further data analysis. With Power Query (also known as Get & Transform), you can set up a query once and then refresh it when new data is added. Power Query can import and clean millions of rows of data.
How to Stop or Control Green Error Checking Markers in Excel
In Microsoft Excel, errors are flagged with small green marker or triangle in the upper left corner of the cell. However, these indicators display when there may be an error but is, in fact, not an error.
Excel Shortcuts to Zoom In and Out in Your Worksheets (4 Shortcuts)
There are several mouse and keyboard shortcuts you can use to zoom in and out in Excel worksheets. Some of these shortcuts are built-in and others can be created by customizing Excel Options.
Microsoft, the Microsoft logo, Microsoft Office and related Microsoft applications and logos are registered trademarks of Microsoft Corporation in Canada, US and other countries. All other trademarks are the property of the registered owners.
Avantix Learning |18 King Street East, Suite 1400, Toronto, Ontario, Canada M5C 1C4 | Contact us at info@avantixlearning.ca