# How to use Formulas in Conditional Formatting in Excel

The best part of conditional formatting is you can use formulas in it.

And, it has a very simple sense to work with formulas.

Your formula should be a logical formula and the result should be in TRUE or FALSE.

If formula returns TRUE, you’ll get the formatting and if FALSE then nothing.

The point is, by using formulas you can make best out of conditional formatting.

Yes, that’s right.

In the below example, we have used a formula in CF to check whether the value in the cell is smaller than 1000 or not.

And if that value is smaller than 1000 it will apply the formatting which we have specified, otherwise not.

So today in this post, I’d like to share with you simple steps to apply conditional formatting using a formula.

And some of the useful examples which you can use in your daily work.

…so let’s get started.

## Steps to Apply CF with Formulas

The steps to apply CF with formulas are quite simple:

• Select the range to apply CF
• Add a formula to text a condition
• Specify a format to apply when the condition is met
• First of all, select the range where you want to apply conditional formatting.
• After that, go to Home Tab ➜ Styles ➜ Conditional Formatting ➜ New Rule ➜ Use a formula to determine which cell to format.
• Now, in the “Format values where formula is true” enter below formula.

=E5<1000

• The next thing is to specify format to apply and for this, click on the format button and select the format.
• In the end, click OK.

PRO Tip: While entering a formula in CF dialog box you can’t see its result whether that formula is valid or not. So the best practice is to check that formula before using in CF by entering it in a cell.

## Top 6 Example to use Formulas in Conditional Formatting

### 1. Use a Formula which is Based on Another Cell

Yes, you can apply conditional formatting based on another cell's value.

If you look at the below example, we have added a simple formula which is based on another cell.

And if the value of that linked cell meets the condition specified, you'll get conditional formatting.

When achievement will be below 75%, it will highlight by the red color.

### 2. Conditional Formatting using IF

Whenever I think about conditions, the first thing comes to your mind is using IF function.

And the best part of this functions is, it fits perfectly in conditional formatting. Let me show you an example:

Here, we have used the IF to create a condition and the condition is when the count of “Done” in range B3:B9 is equal to the count of tasks in the range A3:A9, then the final status will appear.

### 2. Conditional Formatting by using Multiple Conditions

You can create multiple checks in condition to apply formatting.

Once all the conditions or one of the conditions will meet, conditional formatting will apply to the cell.

Look at the below example where we have used the average temperature of my town.

And we have used a simply combined IF-AND to highlight the months where the temperature is pretty pleasant.

Months where the temperature is within 15 Celsius to 35 Celsius, will get colored.

### 4. Highlight Alternate Rows with Conditional Formatting

To highlight every alternate row you can use following formula n CF.

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

By using this formula, every row whose number is odd will be highlighted. And, if you want to do vice versa you can use the following formula.

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

The same kind of formula you can use for columns (odd and even) as well.

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

And for even columns.

`=INT(MOD(COLUMN()+1,2))`

## Points to Remember

1. Your formula should be a logical formula, which leads to a result as TRUE or FALSE.
3. Always use relative and absolute references in a proper sense.

## Conclusion

Conditional formatting is an awesome tool and by using a formula in it you can make best out of it.

I’m pretty sure that above-mentioned examples will inspire you to use it more frequently in your work.

Now, tell me one thing.

Have you ever used formula in CF?

Please share your views with me in the comment section. I'd love to hear from you, and please, don’t forget to share this post with your friends, I am sure they will appreciate it.

1. Highlight Top Bottom N Values: Whenever my boss called me with some sort of reports, I do it for sure to highlight top and bottom values...
2. Apply Conditional Formatting to a Pivot Table: To make it more appealing to your users, you can apply conditional formatting...
3. Highlight Blank Cells in Excel: It’s recommended to highlight these cells with a color so that we can recognize them...
4. VBA Code to Highlight Duplicate Values: Removing these duplicate values or just counting them never sort out...
5. Format Painter: While working in Excel, it happens sometimes that you want to copy formatting from...

Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can ﬁnd him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.

### 6 thoughts

1. Great work bro Weldon

2. how to change cell value ( many cells ) to comments at once??

3. hi, I need an example for my excel class to teach on conditional formatting and spark lines.

4. I have scenario
I need to use Cond formatting with formula like
If I want to show some text in the formatted cell .
Example
cell A1 value starting with “2” like 2806 text need to show : “RJB” in Cell B1.
if Cell A1 Value starting with “4” like 4739 text need to show : “HBB” in cell B1
anyone have solution please send me a email on
[email protected]
Thanks.

5. super idee PUNNET