WallStreetMojo

WallStreetMojo

WallStreetMojo

MENUMENU
  • Blog
  • Free Video Tutorials
  • Courses
  • All in One Bundle
  • Login
Home » Excel, VBA & Power BI » Excel Tutorials » Conditional Formatting in Excel

Conditional Formatting in Excel

By Tanuj KumarTanuj Kumar | Reviewed By Dheeraj VaidyaDheeraj Vaidya, CFA, FRM

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 color 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.

conditional formatting 1

  • Click Conditional Formatting in Excel Styles group, and then click New Rule.

conditional formatting 1-1

  • Click Use a formula to determine which cells to format under Select a Rule Type.

conditional formatting 1-2

  • 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.

conditional formatting 1-3

  • Modify the value in step 6 to be =$A$1=1.

conditional formatting 1-4

  • Click Format.

conditional formatting 1-5

  • In the Format Cells dialogue box, click the Fill.

conditional formatting 1-6

  • Click the color “red,” and then click OK.

conditional formatting 1-7

  • In the New Formatting Rule dialogue box, click OK.

conditional formatting 1-8

  • In cell A1, type 1, and then press the ENTER key.
  • Verify that the color of the cell B1 changed to red.

conditional formatting 1-9

  • Close the Excel worksheet.

How to use the Conditional Formatting Excel Rule?

Let us understand working with simple examples.

Conditional Formatting Example #1

Highlight the data that is greater than 30.

Choose Highlight Cells Rules > Greater Than

conditional formatting example 1

Enter the number.

conditional formatting example 1-1

Below is the result:

conditional formatting example 1-2

Example #2

Highlight the data with duplicate values.

Choose Highlight Cells Rules > Duplicate Values

conditional formatting example 2

Click on Duplicate and OK

conditional formatting example 2-1

The result will be:

conditional formatting example 2-2

Example #3

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.

conditional formatting example 3

Choose Highlight Cells Rules > A Date Occurring.

conditional formatting example 3-1

Within this dialogue box, there are many date – related options available.

conditional formatting example 3-2

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.

Popular Course in this category
Sale
All in One Excel VBA Bundle (35 Courses with Projects)
4.9 (1,353 ratings)
35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
View Course

conditional formatting example 3-3

So the result will be:

conditional formatting example 3-4

Example #4

Here we have a given data set of date and count, and we have to apply the multiple formatting rules.

conditional formatting example 4

First, we highlight the cell value that is between 31 and 43.

conditional formatting example 4-1

conditional formatting example 4-2

Select color yellow fill with Dark yellow text.

conditional formatting example 4-3

The result will be:

conditional formatting example 4-4

And then, apply another formatting on cells that have less than 0 value with the color of Light Red Fill with Dark Red Text.

conditional formatting example 4-5

And the Final Result will look like this:

conditional formatting example 4-6

Example #5

You can use Data bars, color scale, and icon sets in excel for conditional formatting in Excel.

First, we will use Data bars in excel.

Go to Data Bars > Select Blue Data Bar.

conditional formatting example 5

Now, we will use Color Scales.

Go to Color Scales > Select any Color you want to.

conditional formatting example 5-1

Now, we will use the Icon Sets.

Go to Icon Sets > Select any icon you want to.

conditional formatting example 5-2

Finally, the table will look like this

conditional formatting example 5-3

Conditional Formatting can be used in VBA

We can apply the formatting rule using VBA; here is the example as follows:

Sub Example()
ThisWorkbook.Worksheets(1).Range(“A1”).Select
With ThisWorkbook.Worksheets(1).Range(“B1″)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:=”=A1=1”
.FormatConditions(1).Interior.ColorIndex = 46
End With
End Sub

You can download this Conditional Formatting template here – Conditional Formatting Excel Template

Recommended Articles

This has been a guide to Conditional Formatting in Excel. Here we discuss how to use the Conditional Formatting formula along with excel example and downloadable excel templates. You may also look at these useful functions in excel –

  • How to Apply Conditional Formatting for Blank Cells?
  • Conditional Formatting in the Pivot Table
  • MS Excel Training Course Online
0 Shares
Share
Tweet
Share
All in One Excel VBA Bundle (35 Courses with Projects)
  • 35+ Courses
  • 120+ Hours
  • Full Lifetime Access
  • Certificate of Completion
LEARN MORE >>
Primary Sidebar
Footer
COMPANY
About
Reviews
Contact
Privacy
Terms of Service
RESOURCES
Blog
Free Courses
Free Tutorials
Investment Banking Tutorials
Financial Modeling Tutorials
Excel Tutorials
Accounting Tutorials
Financial Statement Analysis
COURSES
All Courses
Financial Analyst All in One Course
Investment Banking Course
Financial Modeling Course
Private Equity Course
Venture Capital Course
Excel All in One Course

Copyright © 2021. CFA Institute Does Not Endorse, Promote, Or Warrant The Accuracy Or Quality Of WallStreetMojo. CFA® And Chartered Financial Analyst® Are Registered Trademarks Owned By CFA Institute.
Return to top

WallStreetMojo

Free Excel Course

Excel functions, Formula, Charts, Formatting creating excel dashboard & others

* Please provide your correct email id. Login details for this Free course will be emailed to you

Book Your One Instructor : One Learner Free Class
Let’s Get Started
Please select the batch
Saturday - Sunday 9 am IST to 5 pm IST
Saturday - Sunday 9 am IST to 5 pm IST

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

WallStreetMojo

Free Excel Course

Excel functions, Formula, Charts, Formatting creating excel dashboard & others

* Please provide your correct email id. Login details for this Free course will be emailed to you

Login

Forgot Password?

WallStreetMojo

Download Conditional Formatting Excel Template

Special Offer - All in One Excel VBA Bundle (35 Courses with Projects) View More