Conditional Formatting in Excel is a technique where we format cells in a worksheet based on certain conditions, conditional formatting option is available in the styles section of the Home tab, there are various conditions provided by excel to use formatting on cells or a user can create a new rule for conditional formatting using a formula.
Conditional Formatting in Excel (with Formulas)
Conditional formatting is a feature in an excel spreadsheet that allows you to apply specific formatting to cells/range that meet the specified criteria/condition. The mostly formatting rule is used as color-based formatting to highlight or distinguish among data and information stored in an excel sheet.
- Conditional formatting formula provides the functionality to highlight cells with a certain color, depending on the cell’s value or a specific condition.
- It is a fantastic way to quickly visualize data in an excel sheet. By conditional formatting rules in Excel, you can highlight data with provided criteria.
- It allows you to visually analyze your data, based on a large number of condition types,
- Greater than, Less than, Between
- Above / Below Average
- Top / Bottom 10
- Top / Bottom 10%
- Duplicates / Unique
- Dates – Dynamic or a fix date range
- Text containing
How to apply conditional formatting in excel?
It will highlight the Cell A1 with red colour if the value in A1 cell will be 1.
- Start Excel, and then open a new Excel worksheet.
- In the Excel worksheet, select any cell A1.
- Click Conditional Formatting in Excel Styles group, and then click New Rule.
- Click Use a formula to determine which cells to format under Select a Rule Type.
- Click inside the Format values where this formula is true Then, select the cell that you want to use for the conditional formatting in excel.
- Modify the value in step 6 to be =$A$1=1.
- Click Format.
- In the Format Cells dialogue box, click the Fill
- Click the color “red,” and then click OK.
- In the New Formatting Rule dialogue box, click OK.
- In cell A1, type 1, and then press ENTER.
- Verify that the color of the cell B1 changed to red.
- Close the Excel worksheet.
How to use the Conditional Formatting Excel Rule?
Let understand working with simple examples.
Conditional Formatting Example #1
Highlight the data that is greater than 30.
Choose Highlight Cells Rules > Greater Than
Enter the number.
Below is the result:
Choose Highlight Cells Rules > Duplicate Values
Click on Duplicate and OK
The result will be:
Apart from simple rules like greater than and duplicates, there are others like “A Date Occurring…”. This condition is based on dates. Many conditions will have sub-conditions. This is one such example.
Here, we will select all the dates and apply the conditional format.
Choose Highlight Cells Rules > A Data Occurring
Within this dialogue box, there are many date – related options available.
We will use ‘This Week’ as we want to highlight all the dates that fall in the current week. Likewise, you can use any other setting, as needed.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
So the result will be:
Here we have a given data set of date and count and we have to apply the multiple formatting rule.
First, we highlight the cell value that is between 31 and 43.
Select color yellow fill with Dark yellow text.
The Result will be:
And then apply another formatting on cells who have less than 0 value with color of Light Red Fill with Dark Red Text.
And the Final Result will look like this:
First, we will use Data bars in excel.
Go to Data Bars > Select Blue Data Bar
Now, we will use Color Scales.
Go to Color Scales > Select any Color you want to.
Now, we will use Icon Sets.
Go to Icon Sets > Select any icon you want to.
Finally, the table will look like this
Conditional Formatting can be used in VBA
We can apply the formatting rule using VBA here is the example as follows:
.FormatConditions.Add Type:=xlExpression, _
.FormatConditions(1).Interior.ColorIndex = 46
You can download this Conditional Formatting template here – Conditional Formatting Excel Template
This has been a guide to Conditional Formatting in Excel. Here we discuss how to use Conditional Formatting formula along with excel example and downloadable excel templates. You may also look at these useful functions in excel –