CPE

Conditional Formatting with a Formula in Excel

6 min read
conditional-formatting-based-on-formula-1-listing-image_edited

Conditional formatting in Excel allows you to automatically format cells based on specific criteria or rules that you define. Instead of manually formatting cells based on changing data, you can set up conditions that will format the cell automatically, making it easier to identify patterns or exceptions in your data. While you can specify formatting based on conditions, you can also leverage a conditional formatting formula and formula-based customization rules. 

We're providing a step-by-step guide to using conditional formatting with a formula so you can enhance how you manage, analyze, and present financial data while saving time! 

How to implement a conditional formatting formula in Excel

To implement a conditional formatting formula in Excel, follow these steps: 

  1. Select the range where the formatting will be applied.
  2. Select CONDITIONAL FORMATTING from the HOME tab on the top ribbon
  3. Select NEW RULE from the drop down menu
  4. Select USE A FORMULA and enter your into the FORMAT VALUES WHERE THIS FORMULA IS TRUE 
  5. Select FORMAT


Conditional formatting with a formula walkthrough

We created a sample walkthrough to help you see exactly how to complete this process using information related to an example real estate company. In this example, we want to create a conditional formatting formula that will subtract the original price of a property from the sale price, and highlight cells with where the selling price was above the original listing price as green. 

First, we highlighted the area to apply the formatting which was J2 through J100. From there, we chose CONDITIONAL FORMATTING under the HOME menu on the top ribbon and choose NEW RULE from the drop-down menu. 

Excel conditional formatting formula image 1

 

After clicking on NEW RULE, a new box is visible, and we chose USE A FORMULA TO DETERMINE WHICH CELLS TO FORMAT.

Excel conditional formatting formula image 2


Below, we entered the conditional formatting formula =I2:I100-H2:H100>0 and then choose FORMAT. Note, there is already a formula applied to column J subtracting column I from column H to determine the difference. 

Image of excel spreadsheet - step to use conditional formatting formula

 

In the format screen, we chose green to highlight sales numbers over zero and clicked OK. We were returned to the screen above with the preview of the formatting. Then we selected OK again. The result is any existing numbers above zero will automatically have a green highlight. 

Excel screenshot showing result of conditional formatting with a formula

 

Learn how to use a conditional formatting formula in Excel

Ready to try it? In the file Beckerfeb2020.xlsx, we demonstrate how to use a conditional formatting formula using a formula capability. In this Excel spreadsheet, we're using quarterly revenues from Amazon in Column E (in millions of dollars). Each line demonstrates the next quarter's revenue. We want to easily see when revenue increases or decreases from quarter to quarter and can easily do this through conditional formatting with a formula.   

conditional-formatting-based-on-formula-1-body-image-01

 

To begin, we select the cell range E6:E85, which is where we want to apply the conditional formatting formula. Then from the HOME tab, we choose CONDITIONAL FORMATTING, followed by NEW RULE from the drop-down menu. 

excel conditional formatting formula 3

 

A new window will pop up, NEW FORMATTING RULE, and from there, you would choose USE A FORMULA TO DETERMINE WHICH CELLS TO FORMAT from the list. In the box titled FORMAT VALUES WHERE THIS FORMULA IS TRUE, we will enter E6>E5 and choose the FORMAT box. We want to highlight this green and will choose the color to reflect that. Finally, we will click OK. 

Note in column F and G the row of TRUE and FALSE. This ensures that any cell in column E that is larger than its preceding cell will automatically highlight green also. Therefore, we fill in the Select a Rule Type dialog box as =E6>E6. After clicking OK, all revenues that were larger than the previous quarter are highlighted in green.

screenshot of excel spreadsheet showing conditional formatting with a formula that uses true/false

We want to format cell E6 in red if E6<E5. If this formula is copied down then whenever the formula is True (see Column G, we should format the quarter’s revenue in green. We can also add a new rule following the same format, where we add the formula =EE6<E5 and choose to format the applicable cells with a red highlight. 

As shown below, the revenues that were larger than the previous quarter are highlighted in green and the revenues that were smaller than the previous quarter are highlighted in red.

conditional-formatting-based-on-formula-1-body-image-04

Figure 4 Revenue increases are highlighted in Green and Revenue decreases are highlighted in Red.

Note that Column E is highlighted in Green if and only if Column F contains TRUE Green and Column E is highlighted in Red if and only if Column G contains TRUE.

If your cursor is anywhere in the range (E6:E85) where the format was applied, selecting Manage Rules from the Conditional Formatting menu will show you the conditional formats (see Figure 5) applied to that range.

conditional-formatting-based-on-formula-1-body-image-05

 

Learn how to use more automation features with our free Excel ebook! 

Conditional formatting is just one way to save time when working in Excel! Download our free ebook, Excel Essentials for Accountants: Boosting Productivity and Accuracy with Automation and learn how to apply a variety of functions, create pivot tables, record a macro in Excel, and so much more! 

Share

FacebookLinkedinXEmail
CPE FREE COURSE
Sidebar CTA
Browse our CPE Offerings

Featured

2024 Tax changes (for filing in 2025)
2024 Tax changes (for filing in 2025)
Read More
Artificial intelligence in auditing
Artificial intelligence in auditing
Read More
How to take a random sample in Excel
How to take a random sample in Excel
Read More

Now Leaving Becker.com

You are leaving the Becker.com website. Once you click “continue,” you will be brought to a third-party website. Please be aware, the privacy policy may differ on the third-party website. Adtalem Global Education is not responsible for the security, contents and accuracy of any information provided on the third-party website. Note that the website may still be a third-party website even the format is similar to the Becker.com website.

Continue