Conditional formatting is now an integral part of the Microsoft Excel experience. This helps us identify particular values in a random or large group of data. We can not only identify certain values but also can identify which belong to a certain range or not in it, string values, numeric values, errors, etc. with conditional formatting. It is, as the name suggests, Excel formatting a cell based on whether a condition is true or not. In this tutorial, we will discuss conditional formatting with the formula in Excel.

**Table of Contents**hide

## Video Tutorial of Using Conditional Formatting with Formula in Excel

In this video lecture:

- You will learn how to format cells using formula-based conditional formatting.
- You will learn about
**the ISTEXT function**. - And you will learn again how to use Absolute Referencing in formulas.

## Download Practice Workbook

You can download the workbook used for the demonstration from the download link below.

## How to Use Conditional Formatting with Formula in Excel

The main theme of using conditional formatting with a formula in Excel is pretty straightforward. We need to select the conditional formatting feature. Then instead of selecting any predetermined option, we need to select a new rule and then select the formula to enter it.

Keep in mind that by formula, we usually enter a condition here in the conditional formatting box. If the condition is true, then the format applies and vice versa.

Here is a detailed demonstration of conditional formatting with formula in Excel.

**Steps:**

- First, select the range of cells you want to format with formulas.
- Now go to the
**Home**tab on your ribbon. - Then select
**Conditional Formatting**from the**Styles**group section. - After that, select
**New Rule**from the drop-down menu.

- As a result, the
**New Formatting Rule**box will now pop up. - Then you can enter the formula in the field under
**Format values where this formula is true:**

- You can also select the format style by clicking on the
**Format** - Once you are done with all the steps above and the formatting styles of the cells, click
**OK**on this box.

For example, we enter the following formula shown in the figure after following all of these steps.

The range on the spreadsheet was **B3:B6**. It will now look like this.

Here, we entered the condition that the cell value is higher than 3. So, in this selection where values higher than 3 exist, the formats apply.

## 21 Examples of Using Conditional Formatting with Formula in Excel

Now in this section, we will demonstrate different examples of using a formula in the conditional formatting feature in Excel. The possibility of using this feature and combining each one with another is huge. So we have tried to cover some major formulas we think you might find informative. If you need a particular one only, you can find them in the table above.

### 1. Format Text Values

First, let’s consider this dataset containing both numeric and string values in it.

With the help of conditional formatting with formula, we can easily single out the string values in Excel. In order to do that, we need to utilize **the ISTEXT function**. Follow these steps to see how we can format using this function in conditional formatting in Excel.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=ISTEXT(B5)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

You will notice that Excel will format all of the texts in the dataset after using this formula in conditional formatting.

### 2. Highlight Cells That Are Equal to Another Cell

Now let’s take a look at another example of matching values.

There is a large collection of data in this dataset. We are going to now format the ones that only match the cell value of **E5**.

Follow these steps to see how we can do that.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=B5=$E$5`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This is how we can highlight cells that are equal to another cell using conditional formatting with the help of formula in Excel.

### 3. Conditional Formatting in Excel Based on Another Cell

Now let’s shift a little bit from being equal. We will now format a dataset based on whether it is larger or smaller than another cell’s value in this section. And we are going to highlight them using conditional formatting using the formula method in Excel.

We will perform this on the following dataset.

We are going to format the range **C5:C9 **based on the value of cell **E5**.

Follow these steps to see how we can do that.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=C5>$E$5`

- Next, select your preferred format type.

- Finally, click on
**OK**. This will be the dataset now.

- Similarly, you can repeat the same process for the lower values and end up with a dataset like this.

This is how we can use conditional formatting with a formula based on another cell’s value in Excel.

### 4. Conditional Formatting Using IF Formula in Excel

Now we are going to see how we can utilize formulas containing **the IF function** as the conditional formatting formula in Excel. We cannot directly use the function in the conditional formatting box. But we can use the function to get a value which we can use to further format cells using conditional formatting in Excel.

Let’s take a dataset for this example first. This is the one we are performing this task on.

**Steps:**

- First, select cell
**E5**and write down the following formula.

`=IF(D5>C5,"Profit","Loss")`

- Then press
**Enter**on your keyboard.

- Now click and drag the fill handle icon to the end of the column to replicate the formula for the rest of the cells.

- Next, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=E5="Profit"`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This will be the dataset now.

This is how we can utilize the **IF **function for the conditional formatting formula in Excel.

### 5. Highlight Cells Using Multiple Conditions

Now let’s go back to the first dataset.

We are now going to highlight all the cells that are either 5,6 or contain the text “cat”.

To do that in the conditional formatting formula box in Excel, we need **the OR function**.

Follow these steps to see how we can do that.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=OR(B5=5,B5=6,B5="cat")`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Now take a look at the dataset.

This is how we can use the **OR **function in the conditional formatting formula in Excel for multiple conditions.

### 6. Highlight Duplicate Rows

Moving on, we are now going to highlight cells in the whole rows where the whole row matches with another one. It is a bit tricky. We are going to need the **COUNTIF **and **CONCATENATE** functions for this.

Let’s take a sample dataset for demonstration.

Here, we can see the third and sixth row fully matches. Follow these steps to see how we can utilize these functions to highlight duplicate values in a column in Excel.

**Steps:**

- First, select cell
**F5**and write down the following formula.

`=CONCATENATE(B5,C5,D5,E5)`

- Then press
**Enter**.

- Now select the cell again and click and drag the fill handle icon to fill up the rest of the cells with the formula for their references.

- It looks a bit messy, but ignore it for now. Now select the range
**B5:B10**. - Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=COUNTIF($F$5:$F$10,$F5)>1`

- Next, select your preferred format type.

- Finally, click on
**OK**. This will be the dataset now.

- Now let’s right-click on the column header of
**F**and select**Hide**from the context menu.

This will be the final spreadsheet view after that.

### 7. Highlight Cell Values Containing Formulas

Now let’s take a look at a dataset that contains formulas to complete.

We are going to use conditional formatting using a formula to highlight these cells. For this reason, we need to use **the ISFORMULA function**.

Follow these steps to see how we can do that.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=ISFORMULA(B5)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This will be the dataset now.

### 8. Highlight Sales from a Particular Region

In this example, we are going to highlight sales from a dataset that belongs to a particular region. Let’s take the following dataset.

Now let’s say we need to highlight the ones that are from Arizona. To do that, follow these steps.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=$D5="Arizona"`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Excel will now mark the sales from Arizona as a result of these steps.

### 9. Highlight Column Differences

We can also highlight rows that have different columns than their adjacent ones. For example, let’s take a look at the following example.

To highlight them using conditional formatting with a formula in Excel, follow these steps.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=$B5<>$C5`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This will be the final product of these steps.

### 10. Using Formula to Highlight Missing Values

In this section, we will use a formula to highlight missing values in conditional formatting in Excel. Let’s take the following dataset for example.

There are some missing values in List 2 that were available in List 1. We are going to highlight them. Follow these steps to see how.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=COUNTIF($D$5:$D$10,$B5)=0`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Excel will highlight the cells for this conditional formatting formula.

### 11. Creating Simple Search Box to Highlight Cells

Now let’s try a fun one, with a combination of different variations. This is the dataset for that.

Here, we will put a value in cell **E4 **and Excel will highlight them in the previous range, all with the conditional formatting with the formula method. We are going to need a combination of the **ISNUMBER** and **SEARCH** functions for this method.

Follow these steps to see how we can do that.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=ISNUMBER(SEARCH($E$4,B5))`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Now, look at the dataset. The texts containing the word game will be marked.

If we change the value in cell **E4**, for example, “health” the highlights will change.

### 12. Highlight Values That Are Less Than Average

Now let’s revisit one of the datasets from before.

We are going to use a basic application of conditional formatting with a formula here in Excel- we are going to highlight the values here that are less than average in column **E**. We need **the AVERAGE function** for this purpose.

Follow these steps to see how we can do that.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=E5<AVERAGE($E$5:$E$10)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This will highlight the values that are less than average in the dataset.

### 13. Highlight Values That Are Greater Than Average

Similar, to the previous one, we are going to highlight the values that are greater than average in this section using the formula method of conditional formatting in Excel. We will have to use **the AVERAGE function** for this task too. The dataset will be the same.

Follow these steps to see the formula and how you can use it.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=E5>AVERAGE($E$5:$E$10)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Thus Excel will highlight all the values that are higher than average in column **E**.

### 14. Find Nearest Value Including Exact Match

Now let’s take another unique example that is practical in data cleaning and analysis. We are going to find the nearest value to a number in a random set of data.

This is the dataset of this example.

As you can see from the figure, we are going to find the value that is closest to the one in cell **C13**. If there is the same value in the dataset, it will highlight that cell instead of the closest value. For this purpose, we will utilize the **MIN**, **ABS**, and **OR** functions.

Follow these steps to see how you can do that.

**Steps:**

- First, we need to perform some calculations. We need to find the smallest difference from this value in that set of data. For that select cell
**C14**and write down the following formula.

`=MIN(ABS(B5:D11-(C13)))`

- Then press
**Enter**.

- Now select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=OR(B5=$C$13-$C$14,B5=$C$13+$C$14)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This will highlight the value that is closest to the value of 1, with conditional formatting formula in Excel.

### 15. Find Top 3 Values

Let’s go back to the random set of data.

This time we are going to find the top 3 values here using conditional formatting with a formula in Excel. The formula consists of **the LARGE function**.

Follow these steps to see how we can do that.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=B5>=LARGE($B$5:$D$11,3)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

As you can see Excel will thus mark the top 3 values from the range using conditional formatting formula.

### 16. Find Bottom 3 Values

Again, we will use the same dataset as before. But this time we will use that to highlight the bottom 3 values from the dataset. Just like before we are gonna need **the SMALL function** for the formula. To see how we can do that, follow these steps.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=B5<=SMALL($B$5:$D$11,3)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This time, Excel will mark the bottom 3 values because of the conditional formatting formula.

### 17. Show Temperature with Color Scale

In this next example, let’s try another interesting usage of formula and conditional formatting in Excel. Here is the dataset for that.

We have taken two columns because we will use a formula to change the color based on the input in cell **E5**. Also, there is a blank row at the start of the dataset. We will need that to utilize the formula we are going to use. The formula consists of **IF** and **AND** functions. To see how you can change the color scheme of these temperatures based on the current temperature, follow these steps.

**Steps:**

- First, select cell
**C6**and write down the following formula in it.

`=IF(B6=$E$5,"",IF(AND(B6<$E$5,$E$5<B5),"",B6))`

- Then press
**Enter**.

- Now select the cell again and click and drag the fill handle icon to replicate the formula for the rest of the cells in the column.

- Next, go to
**Conditional Formatting**from the**Styles**group of the**Home** - Then hover your mouse over the
**Color Scales**. - After that, select your preferred color scale.

- The temperature scale for conditional formatting based on the formula for current temperature will now be complete.

- If we change the value of the current temperature in cell
**E5**, the temperature scale will change accordingly.

This is how we can show the temperature with color scale utilizing formula and conditional formatting in Excel.

### 18. Highlight Alternate Rows with Conditional Formatting

Now let’s go back to one of the previous datasets of random numbers.

With this dataset, we will highlight alternate rows with a color using the conditional formatting formula in Excel. For the formula, we will need the **INT** and **MOD** functions.

The steps to do that are below.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=INT(MOD(ROW(),2))`

- Next, select your preferred format type.

- Finally, click on
**OK**.

This will highlight the alternate rows using the conditional formatting formula in Excel.

### 19. Highlight Cells with Error

Next up, we will be using the conditional formatting formula in Excel to highlight cells with errors. This is particularly helpful with a large number of data in a sheet and where finding errors manually is tiresome. For demonstration, let’s take a look at the following dataset.

There contains two errors in the dataset. We are going to use **the ISERROR function** in the conditional formatting formula to detect them. The formula used below will help us identify them using conditional formatting in Excel.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=ISERROR(B5)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Excel will thus highlight all the errors as a result of using the conditional formatting formula.

### 20. Create Checklist with Conditional Formatting

Now let’s try another fun application of conditional formatting with a formula in Excel. This time we will make a checklist beside a set of data. With the options checked, the original data will change its format. We will use the following dataset.

This is a standard to-do list. Once we check a checkbox in the status column, the task beside it will change the format, let’s say a strikethrough. The basic idea is to use the boolean value of the checkbox to format in column **B**. Also, we will need the **Developer **tab to insert checkboxes. If you don’t have one in your ribbon, click here to **display the Developer tab on your ribbon**.

Follow these steps to see how we can use the Excel conditional formatting formula to create a checklist in detail.

**Steps:**

- First, go to the
**Developer**tab on your ribbon. - Then select
**Insert**from the**Controls**group section.

- After that, select the
**Check box (Form Control)**from the drop-down menu. - Then place the box in its appropriate place.

- Next, right-click on the box and select
**Format Control**from the context menu.

- Now go to the
**Control**tab on the box and select cell**C5**as its linked cell.

- Then click on
**OK**. - Now let’s remove the alt text and place it in the middle of the cell to make it look good.

- Now repeat the process for all of the tasks.

- Once checked, there will be a TRUE/FALSE value on the cells depending on it.

- So let’s use a white font color to make them invisible.

- Now select the task range you want to format.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=C5=TRUE`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Now once we check a check box beside a task, it will format the task beside it. We did all of that using the help of the conditional formatting formula in Excel.

### 21. Highlight Weekends in a Week

Let’s try another example where we will use a formula to highlight weekends in calender week in Excel. We will use the **OR** and **WEEKDAY** functions to create this formula. As for the dataset, we will use the following.

Now follow these steps to see how we can highlight weekends in Excel using conditional formatting using the formula.

**Steps:**

- First, select all the cells in the dataset excluding headers.
- Then go to the
**Home**tab on your ribbon. - After that, select
**Conditional Formatting**from the**Styles**group section. - Next, select
**New Rule**from the drop-down menu.

- In the
**Formatting Rule**box, first, select the**Use a formula to determine which cells to format**option under**Select a Rule Type**. - Then insert the following formula in the
**Format values where this formula is true**.

`=OR(WEEKDAY($B5)=1,WEEKDAY($B5)=7)`

- Next, select your preferred format type.

- Finally, click on
**OK**.

Thus it will highlight the weekends from the calender week, all with the help of conditional formatting in Excel.

## Conclusion

So these were the methods and different examples of using a formula for conditional formatting in Excel. I hope you have grasped the idea of the usage of the feature and can now use it accordingly. Hopefully, you have found this guide helpful and informative. If you have any questions or suggestions let us know in the comments below.

For more guides like this, visit **Exceldemy.com**.