# Conditional Formatting With Formulas

Published on :

21 Aug, 2024

Blog Author :

N/A

Edited by :

Sheeba M

Reviewed by :

Dheeraj Vaidya

## What Is Conditional Formatting With Formulas In Excel?

Conditional Formatting with Formulahighlights the formula cells based on the condition or criteria given by the user and the received output. We can do that by choosing the “Conditional Formatting” section of the “Home” tab. Then, we click the “New Rule”, and theConditional Formatting with Formulasoption to insert formulas that define the cells to format.

For example, you might have used conditional formatting to highlight the top value in the range and duplicate values. All the formulas should be logical. The result will be either “**TRUE**” or “**FALSE**” if the logical test passes, and if the excel logical test fails, we will get nothing.

##### Table of contents

**Conditional Formatting with Formulas**is a feature mainly used for highlighting the logical results of the set formulas based on the criterias. We can set simple formulas like greater or less than any values, or use the**MOD() function**.- It provides a clear distinction between the highlighted cells and the others making the data easy to comprehend and keep track of while working on a large dataset.
- Using this feature, we can highlight alternate rows or columns, starting from the first or the second row or column.

### Overview Of Conditional Formatting With Formulas

The **Conditional Formatting** with the formula window with its features, is shown below.

### How To Use Excel Conditional Formatting With Formulas?

We can use **Excel Conditional Formatting With Formulas** in a few methods, namely:

**Highlight Cells which has Values Less than 500.****Highlight One Cell Based on Another Cell.****Highlight All the Empty Cells in the Range.****Use AND Function to Highlight Cells.****Use OR Function to Highlight Cells.****Use COUNTIF Function to Highlight Cells.****Highlight Every Alternative Row.****Highlight Every Alternative Column.**

### Examples

We will consider some examples for **Conditional Formatting with Formulas **using the above-mentioned methods**.**

#### Example #1 - Highlight Cells which has Values Less than 500

Assume you are working with the sales numbers given below.

**Below is the sales price per unit.****Then, we must go to Conditional Formatting and click on New Rule.****Now, select Use a formula to determine which cells to format.****Now, under Format values where a formula is True, apply the formula =A2<500 and click Format to use the excel formatting.****Then, we must select the format as per our choice.****Now, we can see the preview of the format in the preview box.****Now, click OK to complete the formatting. As a result, it has highlighted all the cells with a number less than 500, as shown below.**

#### Example #2 - Highlight One Cell Based on Another Cell

We can highlight one cell based on another cell’s value. For example, assume we have “**Product**” and “**Sales Price**” data in the first two columns.

The steps to highlight the products from the above table if the sale price is **>220** are,

**Step 1:**First, we must select the “**Product**” range, go to “**Conditional Formatting**”, and click on “**New Rule**”.

**Step 2:**In the formula, we must apply the formula as**B2 > 220**.

**Step 3:**Then, click the “**Format**” key, and apply the format as per choice.

**Step 4:**Then click “**OK**”. Now, we can see that formatting is ready, as shown below.

#### Example #3 - Highlight All the Empty Cells in the Range

Assume we have the below-given data.

We must highlight all the blank or empty cells in the above data because we use the ISBLANK formula in the **Excel Conditional Formatting**.

Apply the below formula in the formulas section.

Now, first, we must select the formatting as per our wish.

Click “**OK**”. It will highlight all the empty cells in the selected range.

#### Example #4 - Use AND Function to Highlight Cells

Consider the below data for this formula.

The steps to highlight the complete row, if the region is **Central **and the sales value is **>500** are,

**Step 1:**We must select the entire data first.

**Step 2:**Next, we must use the AND excel function to test two conditions here. Both the conditions should be “**TRUE**”. Then, we must apply the below formula.

**Step 3:**Click "**Format**."

**Step 4:**We must go to “**FILL**”, and select the required color and effects.

**Step 5: C**lick “**OK**”. Now, we see the rows highlighted if both the conditions are “**TRUE**”.

#### Example #5- Use OR Function to Highlight Cells

For example, consider the below data.

The steps to highlight the city names “**Bangalore**” and “**Mysore**” in the above data range are,

**Step 1:**We select the data first, go to “**Conditional Formatting**”, and click “**New Rule**”.

**Step 2:**Since we need to highlight either of the two value cells, we must apply the OR excel function.

**Step 3:**Then, click “**Format**”, and select the required format.

**Step 4:**Once the formatting is applied, click “**OK**” to complete the task. As a result, a formula would highlight all the cells with values “**Bangalore**” and “**Mysore**”.

#### Example #6 - Use COUNTIF Function to Highlight Cells

Assume you are working with the customer database. First, you need to identify all the clients whose names appear more than five times on the list. Below is the data.

First, we must select the data and **apply the COUNTIF formula** in the formula section.

Then, click “**Format**”, and apply the required formatting.

Consequently, the formula will highlight all the names if the count exceeds 5.

**Amber **is the only name that appears more than five times on the list, as shown above.

#### Example #7 - Highlight Every Alternative Row

We can also have the formula to highlight every alternative row in excel of the data. For example, assume below is the data we are working on.

We will select the data first and apply the formula **=MOD(ROW (), 2).**

We will apply the format as per our wish, and click “**OK**”. As a result, we have every alternate row highlighted by the formula, as shown below.

#### Example #8 - Highlight Every Alternative Column

Like how we have highlighted every alternative row similarly, we can highlight every alternate column. Again, consider the same data for the example.

And apply the formula **=MOD(COLUMN(), 2)**:

Now, copy the above formula, and apply it in the formula section of the **Conditional Formatting**.

Click “**OK**”. We can see now that it has highlighted the alternative columns, as shown below.

If we wish to leave out the first column and highlight the second column, we can use the below formula.

Therefore, this formula will highlight the alternative column starting from the second column, as shown below.

### Important Things To Note

**Conditional Formatting**accepts only logical formulas with either “**TRUE**” or “**FALSE**” results.- A preview of
**Conditional Formatting**is just an indication of how formatting looks. - We must never use absolute reference as in the formula. When applying the formula, if we select the cell directly, it would make it an absolute reference. We need to make it a relative reference in excel.

### Frequently Asked Questions (FAQs)

**1. Where is the Conditional Formatting in Excel found?**

The **Conditional Formatting in Excel **is found using the following path,

First, choose the dataset → select the “**Home**” tab → go to the “**Styles**” group → click the “**Conditional Formatting**” option drop-down → click the “**New Rule**” option, as shown below.

**2. Once applied, how can we remove the Conditional Formatting with Formulas in Excel?**

We can remove the** Conditional Formatting for Formulas** as follows:

• First, choose the entire dataset or the cell range where the **Conditional Formatting Rules** are created.

• Next, select the “**Home**” tab → go to the “**Styles**” group → click the “**Conditional Formatting**” option drop-down → click the “**Clear rules**” option right-arrow → select the “**Clear Rules from Selected Cells**” option, as shown below.

Then, all the cells with **Conditional Formatting** get cleared as it was at the start.

**3. Is there an alternative way to copy the Conditional Formatting with Formulas in Excel?**

An alternate way to copy the** Conditional Formatting Rule **is using the** “Format Painter”.**

• First, select the cells with the **Conditional Formatting Rule** you want to copy.

• Next**, **follow the path** Home → Clipboard **→ **Format Painter, **as shown below.

• Finally**, **apply it to the cell value to paste the **Conditional Formatting**. Then, the font, the color, and every set format will get automatically formatted.

### Download Template

This article must help understand **Conditional Formatting with Formulas **with its formulas and examples. You can download the template here to use it instantly.

### Recommended Articles

This article has been a guide to Conditional Formatting with Formulas. Here we highlight formulas, COUNTIF, AND, OR, MOD, examples and a downloadable excel template. You may learn more about Excel from the following articles: -