The tutorial explains all main features of Excel conditional formatting with examples. You will learn how to do conditional formatting in any version of Excel, efficiently use preset rules or create new ones, edit, copy and clear formatting.
Excel conditional formatting is a really powerful feature when it comes to applying different formats to data that meets certain conditions. It can help you highlight the most important information in your spreadsheets and spot variances of cell values with a quick glance.
Many users, especially beginners, find it intricate and obscure. If you feel intimidated and uncomfortable with this feature, please don't! In fact, conditional formatting in Excel is very straightforward and easy to use, and you will make sure of this in just 5 minutes when you have finished reading this tutorial :)
What is conditional formatting in Excel?
Excel Conditional Formatting is used to apply certain formatting to data that meets one or more conditions. Just like usual cell formatting, it lets you highlight and differentiate your data in various ways by changing cells' fill color, font color, border styles, etc. The difference is that it is more flexible and dynamic - when the data changes, conditional formats get updated automatically to reflect the changes.
Conditional formatting can be applied to individual cells or entire rows based on the value of the formatted cell itself or another cell. To conditionally format your data, you can utilize preset rules such as Color Scales, Data Bars and Icon Sets or create custom rules where you define when and how the selected cells should be highlighted.
Where is conditional formatting in Excel?
In all versions of Excel 2010 through Excel 365, conditional formatting resides in the same place: Home tab > Styles group > Conditional formatting.
Now that you know where to find conditional formatting in Excel, let's move on and see how you can leverage it in your daily work to make more sense of the project you are currently working on.
For our examples, we will use Excel 365, which seems to be the most popular version these days. However, the options are essentially the same in all Excels, so you won't have any problems with following no matter what version is installed on your computer.
How to use conditional formatting in Excel
To truly leverage the capabilities of conditional format, you need to learn how to utilize various rule types. The good news is that whatever rule you are going to apply, it defines the two key things:
- What cells are covered by the rule.
- What condition should be met.
So, here's how you use Excel conditional formatting:
- In your spreadsheet, select the cells you want to format.
- On the Home tab, in the Styles group, click Conditional Formatting.
- From a set of inbuilt rules, choose the one that suits your purpose.
As an example, we are going to highlight values less than 0, so we click Highlight Cells Rules > Less Than… - In the dialog window that appears, enter the value in the box on the left and choose the desired format from the drop-down list on the right (default is Light Red Fill with Dark Red Text).
When done, Excel will show you a preview of formatted data. If you are happy with the preview, click OK.
In a similar manner, you can use any other rule type that is more appropriate for your data, such as:
- Greater than or equal to
- Between two values
- Text that contains specific words or characters
- Date occurring in a certain range
- Duplicate values
- Top/bottom N numbers
How to use a preset rule with custom formatting
If none of the predefined formats suits you, you can choose any other colors for cells' background, font or borders. Here's how:
- In the preset rule dialog box, from the drop-down list on the right, pick Custom Format…
- In the Format Cells dialog window, switch between the Font, Border and Fill tabs to choose the desired font style, border style and background color, respectively. As you do this, you will immediately see a preview of the selected format. When done, click OK.
- Click OK one more time to close the previous dialog window and apply the custom formatting of your choice.
Tips:
- If you want more colors than the standard palette provides, click the More Colors… button on the Fill or Font tab.
- If you wish to apply a gradient background color, click the Fill Effects button on the Fill tab and choose the desired options.
How to create a new conditional formatting rule
If none of the preset rules meets your needs, you can create a new one from scratch. To get it done, follow these steps:
- Select the cells to be formatted and click Conditional Formatting > New Rule.
- In the New Formatting Rule dialog box that opens, select the rule type.
For example, to format cells with percent change less than 5% in either direction, we choose Format only cells that contain, and then configure the rule like shown in the screenshot below: - Click the Format… button, and then choose the Fill or/and Font color you want.
- Click OK twice to close both dialog windows and your conditional formatting is done!
Excel conditional formatting based on another cell
In the previous examples, we highlighted cells based on "hardcoded" values. However, in some cases it makes more sense to base your condition on a value in another cell. The advantage of this approach is that irrespective of how the cell value changes in future, your formatting will adjust automatically to respond to the change.
As an example, let's highlight prices in column B that are greater than the threshold price in cell D2. To accomplish this, the steps are:
- Click Conditional formatting> Highlight Cells Rules > Greater Than…
- In the dialog box that pops up, place the cursor in the text box on the left (or click the Collapse Dialog icon), and select cell D2.
- When done, click OK.
As a result, all the prices higher than the value in D2 will get highlighted with the selected color:
That is the simplest case of conditional formatting based on another cell. More complex scenarios may require the use of formulas. And you can find several examples of such formulas along with the step-by-step instructions here:
Apply multiple conditional formatting rules to same cells
When using conditional formats in Excel, you are not limited to only one rule per cell. You can apply as many rules as your business logic requires.
For example, you can create 3 rules to highlight prices higher than $105 in red, higher than $100 in orange, and higher than $99 in yellow. For the rules to work correctly, you need to arrange them in the right order. If the "greater than 99" rule is placed first, then only the yellow formatting will be applied because the other two rules won't have a chance to be triggered - obviously, any number that is higher than 100 or 105 is also higher than 99 :)
To re-arrange the rules, this is what you need to do:
- Select any cell in your dataset covered by the rules.
- Open the Rules Manager by clicking Conditional Formatting > Manage Rules…
- Click the rule that needs to be applied first, and then use the upward arrow to move it to top. Do the same for the second-in-priority rule.
- Select the Stop If True check box next to all but the last rule because you do not want the subsequent rules to be applied when the prior condition is met.

What is Stop if True in Excel conditional formatting?
The Stop If True option in conditional formatting prevents Excel from processing other rules when a condition in the current rule is met. In other words, if two or more rules are set for the same cell and Stop if True is enabled for the first rule, the subsequent rules are disregarded after the first rule is activated.
In the example above, we have already used this option to ignore subsequent rules when the first-in-priority rule applies. That usage is quite evident. And here are another couple of examples where the use of the Stop If True function is not so obvious but extremely helpful:
How to edit Excel conditional formatting rules
To make some changes to an existing rule, proceed in this way:
- Select any cell to which the rule applies and click Conditional Formatting > Manage Rules…
- In the Rules Manager dialog box, click the rule you want to modify, and then click the Edit Rule… button.
- In the Edit Formatting Rule dialog window, make the required changes and click OK to save the edits.
That dialog window looks very similar to the New Formatting Rule dialog box used for creating a new rule, so you won't have any difficulties with it.
Tip. If you don't see the rule you want to edit, then select This Worksheet from the Show formatting rules for drop-down list at the top of the Rules Manager dialog box. This will display the list of all the rules in your worksheet.
How to copy Excel conditional formatting
To apply a conditional format you've created earlier to other data, you won't need to re-create a similar rule from scratch. Simply use Format Painter to copy the existing conditional formatting rule(s) to another data set. Here's how:
- Click any cell with the formatting you want to copy.
- Click Home > Format Painter. This will change the mouse pointer to a paintbrush.
Tip. To copy the formatting to multiple non-contiguous cells or ranges, double-click Format Painter.
- To paste the copied formatting, click on the first cell and drag the paintbrush down to the last cell in the range you want to format.
- When done, press Esc to stop using the paintbrush.
- Select any cell in your new dataset, open the Rules Manager and check the copied rule(s).
Note. If the copied conditional formatting uses a formula, you may need to adjust cell references in the formula after copying the rule.
How to delete conditional formatting rules
I've saved the easiest part for last :) To delete a rule, you can either:
- Open the Conditional Formatting Rules Manager, select the rule and click the Delete Rule button.
- Select the range of cells, click Conditional Formatting > Clear Rules and choose the option that fits your needs.
This is how you do conditional formatting in Excel. Hopefully, these very simple rules we created were helpful to get a grasp of the basics. Below, you can find a few more tutorials that can help you understand the inner mechanics and expand conditional formatting in your spreadsheets far beyond its traditional uses.
Practice workbook for download
Excel conditional formatting - examples (.xlsx file)
152 comments
hey i have a question
so, i want the value in a cell to a highlight a row
lets say for example the value in a cell is 5 meaning, it should highlight 5 rows
same with the columns, if the cell for the column has a value of 5, it should highlight 5 columns
starting from cell A5 then it should highlight to cell A10
basically, making a highlighted 5x5 matrix
can you help me with that?
Hi! If starting cell of conditional formatting range is for example A10, try this conditional formatting formula. Use ROW function to determine the row number. Define the column number using the COLUMN function.
=AND((ROW(A10)-ROW($A$10))<=$A$1, (COLUMN(A10)-COLUMN($A$10))<=$B$1)
I recommend reading this guide: Relative and absolute cell references in Excel conditional formatting.
Hello
Is it possible to do the following - I have two rules over the same set of cells. The rules are no mutually exclusive. I'd like the first rule to change background colour and the second rule to change font colour - this way I can see when none/one (for each of the rules)/both conditions are met.
However when I set it up - I see that one rule overwrites the other (e g the font colour also covers the background with white, no the background visible from the other rule).
Is it possible to have one rule only change font colour and not background, and another rule to only modify background colour but not font?
Thanks
Actually, I managed to do it myself. Had to got into the "Font colour" rules and make sure the background is set to No colour (by pressing Clear)
I have an array of numbers by year (column) D5:H10, the year is in row 4. I would like to highlight a entire column if the year for that column = the value in a cell that the user enters at the top - cell C2. It seems simple enough, but I'm having trouble.
I tried D$4=$C$2 applied to D4:D10
Hello Sharon!
Select the range D4:H10 and create a conditional formatting rule for it:
=D$4=$C$2
Here is the article that may be helpful to you: Excel: Change the row color based on cell value.
Sir, at present I am facing these two problems. Please help me.
1) I want to know one thing that when we are writing the formulas in the cell then those formulas are visible or going in the formula bar. I want to write that formula or formulas by VBA to solve the problem. How is it possible? If you give a detailed guide, it will be very helpful. For example, I am doing Date of Retirement calculation with EOMONTH or I am writing a specific formula in a cell to calculate Present Age. I want to run these formulas with VBA. How to do? That means, I will write date of birth in one cell and present age in another cell and Retirement Date will be written in another cell simultaneously/automatically.
2) In those cells that cannot be duplicate entries, how can it be solved by conditional formatting? Means, I wrote the ID code in a cell, in the next case when entering that ID, a massage will show that this ID has been entered. It would be very helpful to know in detail how it can be solved.
Hi! Your first question can be solved without VBA with the help of this guide: How to calculate age in Excel from birthday.
The answer to your second question can be found here: Data validation to allow only unique entries and disallow duplicates.
I'm pretty sure it's not possible, but maybe you guys know a way around; Is there any way to do partial formatting of a cell, that's the result of a formula?
I have a cell that's the output of a formula, which is a text string, and I want to underline the first word/first 10 characters of that string.
Hi! You cannot format part of a cell using conditional formatting.
Is there a way to highlight all cells that are not formula (ie. hardcoded) to show where formulas in a range have been written over?
Hi! We have a tool that can solve your task in a couple of clicks - Select by Value & Color tool. Use Select Special Cells - Select cells containing formulas option. The tool is included in the Ultimate Suite for Excel and can be used in a free trial to see how it works.
Hello, I'm trying to determine how I can conditionally format a range of months based off of the Effective and expiration month dates, as well as the Start month.
On the first example, the Start Month is Jan, that would be the first month cell to highlight, followed by the duration of months (differenc between Jan 2023 and March 2024 (14 months).
In the next example, Start month is May, followed by a duration of 16 months ending in Sept (aligned with the Sept expiration date).
Effective date will always be a prior date to the Expiration Date; duration can be anywhere from 6 months to 29 months; Start month will either be same month as effective date or the following month.
Appreciate you taking the time to review!
EffectiveDate ExpirationDate StartMonth Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar Apr May Jun Jul
1/1/2023 3/1/2024 Jan (JAN through March cells would be highlighted)
4/1/2023 7/15/2024 May (MAY through July cells would be highlighted)
Hi! You can find the examples and detailed instructions here: Excel conditional formatting for dates & time: formulas and rules.
Hi, I am trying to highlight all the zero values in a row after a certain number
Example I have:
100 in A1 is the total which is made of
25 (A2), 0 (A3), 20, 15, 0, 40, 0, 0 (A9)
So I want to highlight the 0 values after 40 in cell A7.
The numbers something don't add exactly to 100, so I must use some formula which say highlight if value is zero.
Thanks in advance
Hi! In the conditional formatting formula, you must specify the exact cell by which the conditional formatting is done. In your case this is not possible.
Hello Sir!
I am trying to highlight the whole row based on the first word I insert, for example:
Region 1 = red, Region 2 = blue;
So, when I type region 1, the column and its row will become red.
Do you have a formula that I could use to do this? or do you have the guideline to do this in conditional formatting rules manager?
Hi! Maybe this article will be helpful: Change the row color based on cell value.
Hello! I am trying to highlight cells based on if another cell has a date entered in it (cell in column "I" will need to change color once the corresponding cells in columns L, M, and N (each need to change individually). I do this to have an easy visual que that a sub-task has been completed. Cells in columns L, M, and N will be given dates once reports are issued/tasks completed - cells in L will get dates first, then M, and then N. Each row is a different item, and once the cells from L, M, and N are given dates, I need that row's "I" cell to change color. I was doing it by the NOT ISBLANK function, but then it would multiply/separate out when you open up rules, so adding a new one was difficult. I started out with 3 rules, and then they altered themselves and ended up showing up as twenty some, or more, different rules.
So I guess two questions - do you have a formula that I could use to do this? And how do you keep rules from multiplying/modifying themselves?
Thanks!
Hi! If I understand your task correctly, try the following conditional formatting formula:
=AND(ISNUMBER(L1:N1))
THanks for your well described help on this topic. Can the output be text rather than colour? i.e. if something needs action it would display action rather than red?
Hi! Conditional formatting can only change the format of a cell, not its value. To change the value, use Excel formulas.
Hi,
I am wanting to create a conditional formatting rule that highlights cells D8 and E8 if any cell between F8 and V8 have a value of 1-99. Is this possible?
Thanks in advance! I’ve tried lots of things but can’t get it to work.
Hi! Please try the following conditional formatting formula:
=SUM((F8:V8>0)*(F8:V8<100))>0
I appreciate the help. I'm not sure if you can help further. But when I have applied these rules and reviewed the section you suggested the formulas are highlighting date 8/1/23 yellow and 7/15/23 & 7/17/23 red even though they have not yet passed.
I think you didn't read this article very carefully. If the date is less than today, =$B2
Hey!
So, I am trying to set up a conditional formatting function to highlight cells greater than 130 in each row. However, once the first cell to reach 130 in the row is highlighted, I do not want the following numbers to be highlighted (since the numbers just increase).
I tried using the in-between function but that would give me a range greater than 30 for some rows and simply is not working for the spread I am using.
Is there a specific function for this in conditional formatting?
Hi! If I understand you correctly, to select only the first value greater than 130, select row 2 and create a conditional formatting rule:
=COUNTIF($A$2:A2,">130")=1
You can learn more about COUNTIF in this article: Excel COUNTIF function examples. Hope this is what you need.
i want the conditional formatting i created for a cell to be copied down to the next. but i want the continuation of the references as well. example the first cell's reference is $G$1, the next cell should be $G$2 and so on. i can do this one by one. but is there a faster way to do it. or a shortcut or maybe a command for multiple cells like dragging down. because when i drag down. the reference cell is the same.
Hello!
If you want a conditional formatting formula to apply to a range of cells, don't use an absolute reference. You need a relative reference. I recommend reading this guide: Excel formulas for conditional formatting based on another cell value.
Can you use conditional formatting to change background colour depending on the case of individual letter (CHAR) been LOWER or UPPER? i.e. 'c' or 'C'
Hi!
For uppercase letters, this formula will return TRUE
=AND(CODE(LEFT(A2,1))<91,CODE(LEFT(A2,1))>64)
I hope it’ll be helpful. If something is still unclear, please feel free to ask.
I prefer this:
=EXACT(LEFT(A2,1),UPPER(LEFT(A2,1)))
Sir
in m column 3 text Refund, Failed & Succes
now if text Success than a b c row is highted in colour
thanks
Hello!
To check if the text "Succes" is in the cell, use the formula
=IF(ISNUMBER(SEARCH("Succes",A1,1)),TRUE,FALSE)
You can learn more about SEARCH function in Excel in this article on our blog.
I need to highlight a cell that doesn’t contain 48
Hello!
Please check out the following article on our blog, it’ll be sure to help you with your task:Excel formulas for conditional formatting
Enter formula
=ISERROR(SEARCH("48",A1,1))
Hello- I need your help with conditional format formula. I want it to highlight cell A1 if cell A1 is 50% less than B1. Also if I have a lot of cells with 0 i want to make sure there is no color.
I after that I can create same formula different percentages.
thank you,
Le
Hello!
Please try the following formula:
=A1/B1<=0.5
Good day.
I have a spread sheet of 300+ line. I want to add a formula what hides values what is the same amount, but opposite (positive and negetive).
A1 -35,00
A2 -34,80
A3 -33,26
A4 -15,00
A5 32,12
A6 33,26
A7 34,80
Example:
A1 - Stay
(A2,A7) Hide Same number, but opposite value(positive and negative)
(A3,A6) Hide Same number, but opposite value(positive and negative)
A4 - Stay
A5 - Stay
Thank you
I already answered you!
Dear Concern,
I am very novish in using Excel, I am a business man, for my own business I have to make my Inventory Management System.From viewing Youtube I have almost built my system but in some case I am stuck. In my "Stock Out" section when stock out command quantity is more than (Opening qty+Stock In qty) there I want "SHORT" word should appear. But this thing I cannot do. Can you Please help me in this issue,how can i solve it.
Thanks with regards
Wahid
Hello Wahid!
I think you could find it helpful to learn how to use the IF function.
Please feel free to read this tutorial on our blog: https://www.ablebits.com/office-addins-blog/if-function-excel/
If you have additional questions, I will be delighted to answer them.