If not conditional formatting excel

The IF function allows you to make a logical comparison between a value and what you expect by testing for a condition and returning a result if that condition is True or False.

  • =IF(Something is True, then do something, otherwise do something else)

But what if you need to test multiple conditions, where let’s say all conditions need to be True or False (AND), or only one condition needs to be True or False (OR), or if you want to check if a condition does NOT meet your criteria? All 3 functions can be used on their own, but it’s much more common to see them paired with IF functions.

Use the IF function along with AND, OR and NOT to perform multiple evaluations if conditions are True or False.

Syntax

  • IF(AND()) — IF(AND(logical1, [logical2], …), value_if_true, [value_if_false]))

  • IF(OR()) — IF(OR(logical1, [logical2], …), value_if_true, [value_if_false]))

  • IF(NOT()) — IF(NOT(logical1), value_if_true, [value_if_false]))

Argument name

Description

logical_test (required)

The condition you want to test.

value_if_true (required)

The value that you want returned if the result of logical_test is TRUE.

value_if_false (optional)

The value that you want returned if the result of logical_test is FALSE.

Here are overviews of how to structure AND, OR and NOT functions individually. When you combine each one of them with an IF statement, they read like this:

  • AND – =IF(AND(Something is True, Something else is True), Value if True, Value if False)

  • OR – =IF(OR(Something is True, Something else is True), Value if True, Value if False)

  • NOT – =IF(NOT(Something is True), Value if True, Value if False)

Examples

Following are examples of some common nested IF(AND()), IF(OR()) and IF(NOT()) statements. The AND and OR functions can support up to 255 individual conditions, but it’s not good practice to use more than a few because complex, nested formulas can get very difficult to build, test and maintain. The NOT function only takes one condition.

Examples of using IF with AND, OR and NOT to evaluate numeric values and text

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(AND(A2>0,B2<100),TRUE, FALSE)

IF A2 (25) is greater than 0, AND B2 (75) is less than 100, then return TRUE, otherwise return FALSE. In this case both conditions are true, so TRUE is returned.

=IF(AND(A3=»Red»,B3=»Green»),TRUE,FALSE)

If A3 (“Blue”) = “Red”, AND B3 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case only the first condition is true, so FALSE is returned.

=IF(OR(A4>0,B4<50),TRUE, FALSE)

IF A4 (25) is greater than 0, OR B4 (75) is less than 50, then return TRUE, otherwise return FALSE. In this case, only the first condition is TRUE, but since OR only requires one argument to be true the formula returns TRUE.

=IF(OR(A5=»Red»,B5=»Green»),TRUE,FALSE)

IF A5 (“Blue”) equals “Red”, OR B5 (“Green”) equals “Green” then return TRUE, otherwise return FALSE. In this case, the second argument is True, so the formula returns TRUE.

=IF(NOT(A6>50),TRUE,FALSE)

IF A6 (25) is NOT greater than 50, then return TRUE, otherwise return FALSE. In this case 25 is not greater than 50, so the formula returns TRUE.

=IF(NOT(A7=»Red»),TRUE,FALSE)

IF A7 (“Blue”) is NOT equal to “Red”, then return TRUE, otherwise return FALSE.

Note that all of the examples have a closing parenthesis after their respective conditions are entered. The remaining True/False arguments are then left as part of the outer IF statement. You can also substitute Text or Numeric values for the TRUE/FALSE values to be returned in the examples.

Here are some examples of using AND, OR and NOT to evaluate dates.

Examples of using IF with AND, OR and NOT to evaluate dates

Here are the formulas spelled out according to their logic:

Formula

Description

=IF(A2>B2,TRUE,FALSE)

IF A2 is greater than B2, return TRUE, otherwise return FALSE. 03/12/14 is greater than 01/01/14, so the formula returns TRUE.

=IF(AND(A3>B2,A3<C2),TRUE,FALSE)

IF A3 is greater than B2 AND A3 is less than C2, return TRUE, otherwise return FALSE. In this case both arguments are true, so the formula returns TRUE.

=IF(OR(A4>B2,A4<B2+60),TRUE,FALSE)

IF A4 is greater than B2 OR A4 is less than B2 + 60, return TRUE, otherwise return FALSE. In this case the first argument is true, but the second is false. Since OR only needs one of the arguments to be true, the formula returns TRUE. If you use the Evaluate Formula Wizard from the Formula tab you’ll see how Excel evaluates the formula.

=IF(NOT(A5>B2),TRUE,FALSE)

IF A5 is not greater than B2, then return TRUE, otherwise return FALSE. In this case, A5 is greater than B2, so the formula returns FALSE.

Example of the Evaluate Formula Wizard

Using AND, OR and NOT with Conditional Formatting

You can also use AND, OR and NOT to set Conditional Formatting criteria with the formula option. When you do this you can omit the IF function and use AND, OR and NOT on their own.

From the Home tab, click Conditional Formatting > New Rule. Next, select the “Use a formula to determine which cells to format” option, enter your formula and apply the format of your choice.

Conditional Formatting > Edit Rule dialog showing the Formula method

Using the earlier Dates example, here is what the formulas would be.

Example of using AND, OR and NOT as Conditional Formatting tests

Formula

Description

=A2>B2

If A2 is greater than B2, format the cell, otherwise do nothing.

=AND(A3>B2,A3<C2)

If A3 is greater than B2 AND A3 is less than C2, format the cell, otherwise do nothing.

=OR(A4>B2,A4<B2+60)

If A4 is greater than B2 OR A4 is less than B2 plus 60 (days), then format the cell, otherwise do nothing.

=NOT(A5>B2)

If A5 is NOT greater than B2, format the cell, otherwise do nothing. In this case A5 is greater than B2, so the result will return FALSE. If you were to change the formula to =NOT(B2>A5) it would return TRUE and the cell would be formatted.

Note: A common error is to enter your formula into Conditional Formatting without the equals sign (=). If you do this you’ll see that the Conditional Formatting dialog will add the equals sign and quotes to the formula — =»OR(A4>B2,A4<B2+60)», so you’ll need to remove the quotes before the formula will respond properly.

Need more help?

Connect with an expert. Learn from live instructors.​​​​​​​

See also

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Learn how to use nested functions in a formula

IF function

AND function

OR function

NOT function

Overview of formulas in Excel

How to avoid broken formulas

Detect errors in formulas

Keyboard shortcuts in Excel

Logical functions (reference)

Excel functions (alphabetical)

Excel functions (by category)

Spreadsheets are the go-to information hub for individuals, teams, and organizations of all sizes to store data. However, large data sets can make it difficult to identify trends, pick out key pieces of information, and track deadlines. Luckily, Microsoft Excel has a feature called conditional formatting that alleviates some of these challenges. 

Conditional formatting enables you to apply special formatting to cells in your spreadsheet that meet certain criteria. Excel has a sizable library of preset conditions that you can apply fairly simply, or you can create your own conditional formatting rules using Excel formulas. This guide will provide in-depth step-by-step examples of the most popular conditional formatting functions for basic and advanced users in Excel 2016. Then, we’ll show you how to perform the same functions in another spreadsheet application, Smartsheet.

What Is Conditional Formatting?

Conditional formatting is a feature of many spreadsheet applications that allows you to apply special formatting to cells that meet certain criteria. It is most often used to highlight, emphasize, or differentiate among data and information stored in a spreadsheet. 

Conditional formatting enables spreadsheet users to do a number of things. First and foremost, it calls attention to important data points such as deadlines, at-risk tasks, or budget items. It can also make large data sets more digestible by breaking up the wall of numbers with a visual organizational component. Finally, conditional formatting can transform your spreadsheet (that previously only stored data) into a dependable “alert” system that highlights key information and keeps you on top of your workload. 

Originally a powerful feature of Excel, other spreadsheet applications have also adopted this functionality. 

Conditional Formatting Basics

Conditional formatting consists of four main components: if-then commands, preset conditions, custom conditions, and applying multiple conditions. We’ve outlined how to use these commands and conditions to create and apply rules to your Excel spreadsheets below:

  • If-Then Logic: All conditional formatting rules are based on simple if-then logic: if X criteria is true, then Y formatting will be applied (this is often written as p → q, or if p is true, then apply q). You won’t have to hard-code any logic, though — Excel and other spreadsheet apps have built-in parameters so you can simply select the conditions you want the rules to meet. Advanced users can also apply the program’s built-in formulas to logic rules.
  • Preset Conditions: Excel has a huge library of preset rules encompassing nearly all functions that beginner users will want to apply. We’ll familiarize you with several of the most popular ones in the next section. 
  • Custom Conditions: For situations where you want to manipulate a preset condition, you can create your own rules. If appropriate, you can use Excel formulas in the rules you write.
  • Applying Multiple Conditions: You can apply multiple rules to a single cell or range of cells. However, be aware of rule hierarchy and precedence — we’ll show you how to manage stacked rules in the walkthrough.

Overall, applying conditional formatting is an easy way to keep you and your team members up to date with your data — calling visual attention to important dates and deadlines, tasks and assignments, budget constraints, and anything else you might want to highlight. When applied correctly, conditional formatting will make you more productive by reducing time spent manually combing data and making it easier to identify trends, so you can focus on the big decisions.

How to Apply Basic Conditional Formatting in Excel

You can apply conditional formatting to your Excel spreadsheets using various tools and features found within the program. This step-by-step walkthrough shows you how to apply the most commonly used formatting for highlighting, data bars, color scales, and more.

Step 1: Apply Highlight Rules to Your Excel Spreadsheet

Highlight rules apply color formatting to cells that meet specific criteria that you define. They are the most basic type of conditional formatting rule, and Excel provides a variety of preset highlight functions. 

  1. Open an existing spreadsheet in Excel, or start from scratch and manually enter new data. In this example, we’re using an inventory list that tracks the number of each item currently in stock, as well as some additional information about each product. 
     

  2. To apply highlight rules, select the range of values you want to apply a rule to. For this example, we want to highlight any product that’s quantity is less than 100 units. So, select the values in the Qty. column (C4:C26). 
  3. From the Home tab, click Conditional Formatting on the right side of the toolbar, and click Highlight Cells Rules from the dropdown menu. Click Less than
     

    Conditional formatting highlight cells rules Excel

  4. A box will appear. Type 100 in the empty field. Click OK
     

  5. Your spreadsheet will now reflect this highlight rule, with the quantities less than 100 highlighted red with red text. 

    Tip: You can change the color of the highlighted cell by clicking on the Format with: dropdown menu and selecting on another option.

    Conditional formatting first rule highlight Excel

  6. To highlight text cells, repeat step 2. This time, we want to highlight certain model types (M compatible), so we’ll select the cells in the Item name column.
  7. Click Conditional Formatting > Highlight Cells Rules > Text that Contains…
     

  8. ​Type M compatible in the text box. To differentiate from our previous highlight rule, select green fill with dark green text from the Format with: dropdown menu. Click OK
     

    Conditional formatting M compatible Excel

  9. Now, cells containing the text M compatible are highlighted.
     

    Conditional formatting changes updated Excel

Using these same steps and menu options, you can apply highlight rules to find Duplicate Values, Dates, or values that are Greater than…, Equal to…, or Between… values that you select. All of these possibilities are available through the menu options. 

Step 2: Create Top/Bottom Rules

Step 3: Apply Data Bars

Data bars apply a visual bar within each cell. The length of the bar relates the value of the cell to other cell values in the selected range. 

  1. We’ll apply data bars to the Qty. column so we can easily assess the ratios of items in stock. Click the top of the Qty. column to select this range of cells. 
  2. Click Conditional Formatting > Data Bars. You’ll see two options — one for Gradient Fill and one for Solid Fill. They function identically; just select the option and color you prefer. 
     

    Conditional formatting choose data bars Excel

  3. Your sheet will now reflect the added rule. 
     

    Conditional formatting data bars highlighted updates Excel

Step 4: Apply Color Scales

Color scales are similar to data bars in that they relate a cell’s values in a selected range. However, instead of representing this relationship by the length of a bar, color scales do so with color gradients. One color is assigned the “lowest” value and another the “highest,” with a range of colors in between. 

  1. We’ll apply color scales to our Selling price column. Click the top of column D to select this range. 
  2. Click Conditional Formatting > Color Scales. You’ll see a variety of different color ranges; select the one you want.
     

    Conditional formatting color scales Excel

  3. Your spreadsheet now shows the selling prices by color — red cells are the most expensive, and green cells are the least expensive. 
     

    Conditional formatting prices by color Excel

Step 5: Apply Icon Sets

Icon sets apply colorful icons to data. They are simply another way to call attention to important data, and relate cells to one another. 

  1. We’ll apply icon sets to the Purchase price column to show low, middle, and high priced items. Click the top of the Purchase price column to select the range of values. 
  2. Click Conditional Formatting > Icon Sets. You’ll see a variety of options for Directional, Shapes, Indicators, and Ratings icons. You can choose any of these to fit the needs of your data. In this example, we’ll choose the first Directional option: red, yellow, and green arrows that indicate high, middle, or low priced items. 
     

    Conditional formatting icon sets Excel

  3. Your sheet reflects this new formatting rule.
     

    Conditional formatting icon sets rule highlight Excel

Step 6: Edit and Delete Conditional Formatting Rules

Now you’ve learned the most common conditional formatting presets in Excel, your spreadsheet provides a lot of information at a glance. However, you might want to edit some of these rules later on, or delete them completely. 

  1. Click Conditional Formatting and select Manage Rules… from the dropdown list. 
     

    Conditional formatting manage rules Excel

  2. The Manage Rules box will appear. Click the dropdown menu at the top of the box and click This Sheet to list the conditional formatting rules you have applied to the current sheet. 
     

    Conditional formatting manage rules this sheet Excel

  3. To edit a rule, click the rule you want to change. In this example, we want to highlight the bottom ten values in the Total value of stock column, rather than the bottom five that we currently have highlighted. Click the Bottom 5 row. Then, click Edit Rule… at the bottom of the box. 
     

    Conditional formatting edit rule Excel

  4. A new box opens where you can adjust the conditions of the rule. Type 10 in the number field and click OK
     

    Conditional formatting edit formatting rule Excel

  5. Excel will bring you back to the Manage Rules box. You must click OK to save the changes you made to the original rule. 
     

    Conditional formatting rule changing highlight Excel

  6. To delete a rule, return to the Manage Rules box and choose This Sheet. Click the rule you want to delete — in this case, the color grading on Selling price. Click the — symbol (next to Edit Rule…) in the lower left hand corner. Click OK
     

    Conditional formatting delete rule Excel

  7. The conditional formatting on the Selling price column is now deleted. 
     

    Conditional formatting delete rule changes highlight Excel

You now have everything need to create basic conditional formatting using presets in Excel 2016. For more advanced functionality such as creating a new rule, using Excel formulas, and creating rules dependent on another cell, see the “Advanced” section below. 

First, we’ll look at how we can apply the same conditional formatting rules we learned in Excel to another spreadsheet program, Smartsheet. 

How to Apply Basic Conditional Formatting in Smartsheet

Use conditional formatting in Smartsheet to apply many of the same rules and effects available in Excel. We’ll guide you through every function described in the previous section, with some modifications that better align with Smartsheet features.

You can create spreadsheets in Smartsheet two ways: by manually entering data into Smartsheet, or by importing an existing spreadsheet from programs like Excel and MS Project. For this tutorial, we’ll use the same data set from the Excel tutorial, so we’ll import the original version (with no conditional formatting) from Excel. 

Step 1: Open Your Existing Excel Spreadsheet in Smartsheet

Step 2: Apply Highlight Rules

  1. ​​​​​​To highlight a cell, click the conditional formatting icon on the toolbar. 
  2. A box will appear where you can set conditional formatting rules. Click Add New Rule in the top left corner. The if-then logic is already written into the new rule, so you can simply create the conditions. 
     

    Conditional Formatting Window

  3. Click set condition. Just like in the Excel example, we want to highlight any items that are stocked below 100 units. Select Qty. from the column list on the left, select is less than from the center dropdown list, and then type 100 in the field on the right. Click OK
     

    Set Quantity Condition

  4. Now we need to apply the formatting. Click this format and a dropdown menu with formatting options appears. For this example, we’ll use a paint fill. Click the paint bucket icon and select red. 
     

    Add Quantity Condition

  5. Specify which cells should get this formatting. Smartsheet will default to format the entire row, but we only want to highlight the cells in the Qty. column. Click entire row and click Qty. from the dropdown list. Click OK
     

    Set Quantity Condition Entire Row

  6. Your conditional formatting rule is now reflected in your spreadsheet.
     

    Quantity Conditional Formatting Smartsheet

  7. To highlight text cells, repeat steps 1 and 2. Click set condition. Now, we want to highlight any M compatible items. Select Item name from the left-most list, contains from the center list, and type M compatible in the right field. Click OK
     

    Item Name Conditioning Formatting

  8. Click this format and click the paint bucket item. Select green. For this rule, we want to highlight the entire row. (Again, Smartsheet defaults to this option.) Click OK
     

    Set Item Name Conditional Formatting

  9. Your second rule is now reflected in your data set. 
     

    Item Name Conditional Formatting Smartsheet

Step 3: Apply Progress Bars (Data Bars)

In place of Excel’s Data Bars preset, you can create Progress Bars in Smartsheet. Progress Bars are a symbol that you can apply to cells to show and compare the level of completeness. In this example, we’ll apply progress bars to denote current inventory levels (from zero to 100 percent). 

  1. To create Progress Bars in Smartsheet, you first need to create a new Symbols column. Cells in a Symbols column will only hold special characters, such as progress bars. 
  2. To create a new column, right-click the Qty. column and click Insert Column Right.
     

    Insert Column Right

  3. A box will open. We’ll name this column Inventory Level, and select Symbols… from the list of column-types. In the right-hand field, scroll down and select the progress bar icon. Click OK.
     

    Add Progress Bar

  4. Click into cells in the new Inventory Level column and select the appropriate level of inventory: Empty, Quarter, Half, Three Quarter, or Full. This progress bar relates the current level (from the Qty. column) to level you need. 
     

    Set Progress Bars

  5. Here’s what your sheet will look like when all progress bars are filled in. 

    Progress Bars in Smartsheet

Tip: You can also type Empty, Quarter, Half, Three Quarter, or Full into each cell, and Smartsheet will autofill with the appropriate progress bar. 

Manually Enter Progress Status

Tip: You can also automate progress bars by using an if-then formula in Smartsheet. For more information on how to do this, check out this resource on symbol formulas.

Step 4: Apply Icon Sets

To apply icon sets in Smartsheet with conditional formatting, you’ll have to use formulas (we’ll get into that in the “Advanced” section). Instead, you can add informative icons to your data by creating a special Symbols column. 

  1. Right-click the Qty. column and click Insert Column Right
     

    Insert New Column

  2. In the box that opens, type Qty. Status in the name field. Click Symbols from the dropdown menu and choose from the library of available symbols (Flag, Priority, Decision, Status, Direction, and Measure icons). In this example, we’ll choose RYG balls in the Status section. Click OK
     

    Add Progress Symbols

  3. Now, you can update your sheet with the appropriate color status ball by adding conditional formatting as shown above. 
     

    Progress Symbols in Smartsheet

Step 5: Edit and Delete Conditional Formatting Rules

Editing and deleting conditional formatting rules in Smartsheet is extremely easy. 

  1. To edit a rule, click the Conditional Formatting icon on the toolbar to open the list of rules. Click the condition you wish to change and edit the information in the box that opens. Click OK
     

    Edit Conditional Formatting

  2. To delete a rule, click the carrot on the left side of each rule. Click Delete Rule from the dropdown menu. Click OK
     

    Delete Conditional Formatting

Tip: You can also disable a rule by clicking Disable Rule from the dropdown menu and then clicking OK. This will put the rule on “hold” without deleting it, in case you want to re-enable it later on. 

Now you know how to use conditional formatting and other colors and symbols to add formatting to your sheet in Smartsheet. In the following sections, we’ll walk you through more advanced conditional formatting functions in Excel and Smartsheet.

Advanced Conditional Formatting Functions in Excel

Once you have mastered the basics, Excel includes some additional advanced conditional formatting functions. We’ll guide you through applying stop-if-true rules, using the AND formula, setting rule hierarchies and precedence, and other unique situational formatting conditions below.

Step 1: Create a New Rule and Apply Stop if true Rule

In some instances, you might want to stop a certain condition, without deleting the entire rule. The Stop if true rule in Excel enables you to do so. 

  1. In our example, we applied an icon set of three directional arrows to the Purchase price column to indicate low, medium, and high price ranges. However, we might actually only want to call attention to the lowest cost items, as three icons can clutter the sheet (and provide more information than actually needed). 
  2. First, create a separate condition on this column. Click the Purchase price column to select these values. 
  3. Click Conditional Formatting > Manage Rules… to open the Manage Rules box. Keep the default Show formatting rules for: Current Selection from the dropdown menu, because we are only adjusting the rule on this column. 
     

    Conditional formatting current selection Excel

  4. Click the + in the bottom left corner to create a new rule. A new box opens where you can  assign conditions to the new rule. 
  5. From the Style menu, select Classic
  6. Instead of applying a different icon to bottom, middle, and top price ranges (as we currently have), we only want to show the bottom 50 percent. So, select Top from the left dropdown menu, type 50 in the middle field, and check the Percent box. 
     

    Conditional formatting percent selection excel

  7. To apply color formatting, Select Custom format from the Format with dropdown menu, and a new formatting box opens. Click the Fill tab, and click No Color.
     

    Conditional formatting no fill color Excel

  8. Next, click the Font tab, and select black text. Click OK
     

    Conditional formatting choose font color Excel

  9. Click OK again in the original New Formatting Rule box. 
  10. You’ll return to the Manage Rules box, where you now have two rules applied to the Purchase price column. Click the Stop if true box to the right of the new rule you just created. Click OK
     

    Conditional formatting stop if true Excel

  11. Your sheet will now only show the icon sets for the items with a purchase price in the bottom 50 percent. 
     

    Conditional formatting stop if true updates Excel

Step 2: Apply Multiple Conditions to a Rule with AND Formula

Adding Excel’s formulas to your conditional formatting rules is one way to elevate your logical rules. The  AND formula is one of the most popular, easy-to-use formulas. It lets you add multiple conditions within a single rule, rather than writing out each rule separately. To format cells they must meet both conditions.

  1. We’ll create a new rule to highlight any cell in the Item # column that contains both a B and an L. Click the top of the Item # column to select this range of cells. 
  2. Click Conditional Formatting > New Rule
  3. In the dialogue box, select Classic from the top dropdown list. Select Use a formula to determine which cells to format, since we’re using a formula. 
  4. We want to search cells in the Item # column for a B and L, and highlight that cell when both conditions are true. To do this, we’ll use Excel’s ISNUMBER and SEARCH formulas, with the AND formula, to look for the B and L values. 
  5. =AND(ISNUMBER(SEARCH(«B»,A1)),ISNUMBER(SEARCH(«L»,A1)))
     

    Conditional formatting edit formatting rule classic Excel

  6. Click OK. Your sheet will highlight all cells in Item # that meet both of these conditions. 
     

    Conditional formatting both conditions met Excel

Tip: Understanding the formula: 

  • We use AND at the beginning of the formula to show that both of the following conditions must be met in order to apply the conditional formatting.
  • The basic syntax of the nested formula is ISNUMBER(SEARCH(“substring”,text)) where “substring” is the character(s) you are looking for, and “text” is the cell(s) you want to search. 
  • We are searching for two separate conditions, so we write the ISNUMBER(SEARCH(“substring”,text)) formula twice, separated by a comma. 

This example is just one of hundreds of different formulas you could enter with the AND function. For more information on using Excel formulas with conditional formatting, click here.

Step 3: Conditional Formatting Based on Another Cell

You can also create rules to highlight certain cells based on the value of another cell. 

  1. In this example, we’ll create a “quantity threshold” — items with inventory level below this threshold will be considered “at risk.” We already have a rule that highlights cells in the Qty. column under 100. However, that threshold might change over time, depending on manufacturing or selling rates. So, we want to create a highlight rule that is dependent upon a threshold that we set.
  2. To the right of your data, create a box for Quantity Threshold and choose an amount. In this example, we use 200. (Note the cell you type the amount in. Here, it’s I5.)
     

    Conditional formatting quantity threshold Excel

  3. Create a new rule by clicking Conditional Formatting > New Rule
  4. In the dialogue box, click Classic and Use a formula to determine which cells to format from the dropdown menus. 
  5. In the formula field, type =C4<$I$5 and keep the default formatting. Click OK
     

    Conditional formatting edit formatting rule edit formula Excel

  6. Numbers in the Qty. column that are less than the Quantity Threshold in I5 (200) will now be highlighted. 
  7. Now, you’ve created a dynamic rule. This means that as your threshold changes, the rule will still be applied to the Qty. column and the formatting will adjust as appropriate. 

Tip: Understanding the formula:

  • In this formula, we are simply testing whether or not values in column C are less than the value in I5. 
  • Start with “=C4” to tell Excel where we want to start evaluating values from. 
  • Use ‘$’ symbol around I because it’s an absolute value — we are only evaluating cells in column C against this single cell. 

Step 4: Data Validation and Dropdown Lists

While data validation is not technically monitored through conditional formatting rules, you can use it to a similar effect: controlling the formatting of your sheet. You can apply data validation to ensure that any cell-type only allows certain entries (text or numbers only, text length, etc.). In this example, we’ll show you how to create a dropdown list and validate data only from that dropdown list. 

  1. We’ll create an additional column of which employee last updated the sheet, and create a dropdown list to choose from. First, click where you want to add the column on the sheet. Create a new column by clicking Insert > Insert Sheet Columns from the ribbon on the Home tab. 
     

    Conditional formatting insert_sheet_column

  2. We’ll name this column Updated By
  3. Now we need to make a list of employees, that the dropdown list will later pull from. Create a second sheet (in the same Excel workbook) by clicking the + sign on the tab at the bottom of the spreadsheet, and write a list of employee names in column B.
     

    Conditional formatting second sheet Excel

  4. Select the range of data (all the names) you want to include in your list. Make this list into a table by clicking the Insert tab > Table
  5. The dialogue box will show the range of data you selected for the table. Click My table has headers, since we began the list with Employees. Click OK.
     

    Conditional formatting create table Excel

  6. Now we have to name this list so that Sheet 1 can pull from it. Click Formulas tab  > Define Name on the ribbon. 
     

    Conditional formatting verify name Excel

  7. In the dialogue box, type the name of the list. We’ll call it Employees. Double check that the selected range is still correct. Click OK
     

    Conditional formatting verify name Excel

  8. Go back to Sheet 1. Now, we have to make the Updated By column into a dropdown list. We’ll use the data validation function to do this. 
  9. Select the Updated By column to apply data validation to this range of cells.
  10. Click the Data tab on the ribbon and click Data Validation > Data Validation…
     

    Conditional formatting data validation Excel

  11. In the dialogue box, choose List from the dropdown menu to restrict data entered in this range to a list. Type =Employees in the Source field, since we’re pulling from the list we just created (in Sheet 2). Click OK.
     

    Conditional formatting data validation source Excel

  12. There is now a dropdown list in the Updated By column. Your sheet will only accept data in this column that comes from the Employees list on Sheet 2. 
     

    Conditional formatting choose value for updated by column Excel

  13. You can now fill in the column by selecting a name from the dropdown list. 
     

    Conditional formatting updated by column highlight Excel

Step 5: Rule Hierarchy and Precedence

As you accumulate conditional formatting rules, watch out for rule hierarchy. Since you can apply multiple conditions to a cell (or row), they occasionally conflict. When this happens, Excel has default precedence rules that may cause one rule to override another, so you can lose your formatting. To combat this, you can change the hierarchy of the rules. 

Adjusting rule hierarchy in Excel is straightforward, but you should also understand the logic behind rule precedence:

  • Newer rules will always assume precedence over older rules. This means that the precedence of your rules will be in the reverse order of how you created them.
  • When multiple rules evaluate as true to a cell, they may or may not conflict. Applying multiple rules to a cell does not necessarily mean that they will interfere. 
  • Rules don’t conflict if they are changing different things about the cell. For instance, if one rule changes text color and another changes fill color both rules should co-exist in the cell. 
  • Rules conflict when the outcomes are the same. For instance, if one rule changes a font color to green and another changes the font color to blue the newer rule takes precedence.

To adjust rule hierarchy in Excel, follow these steps:

  1. All rule hierarchy is controlled through the Rule Manager in Excel. 
  2. From the Home tab, click Conditional Formatting > Manage Rules… to open the Rule Manager. 
  3. Select This Sheet from the top dropdown list to pull up all lists applied to the current sheet. 
  4. To change the order (hierarchy) of rules, select a rule and click the up and down arrows in the top right corner to move it. Click OK. Remember the rule closest to the top will take precedence.
     

    Conditional formatting change rules hierarchy Excel

Advanced Conditional Formatting in Smartsheet

Many advanced Excel conditional formatting options are available to Smartsheet users, as well. We’ll teach you how to apply stop-if-true rules, create rules with multiple conditions, create formatting rules based on other cells, and set rule hierarchies and precedence.

Step 1: Add New Rule and Apply Stop If True Function

Adding a new rule in Smartsheet is easy (you already learned how in the “Basic” section). Now, we’ll apply the same “stop if true” logic from Excel in Smartsheet. 

  1. Add a new rule by clicking the conditional formatting icon on the toolbar. Click Add New Rule and click Set condition.
  2. For this rule, we want to call attention to the shipment order dates that are after 06/20/30. The easiest way to do this is to apply the same logic as “stop if true” in Excel. 
  3. Click Shipment Order Date in the left field to set a condition in this column. 
  4. Instead of defining criteria (as we have been doing), click select from a list. The list of values in the Shipment Order Date column appear. 
     

    If True Function

     

  5. Click 06/20/30. Then, because we want to highlight all the dates that are not this date, check the Apply format when this condition is NOT met box. (This functions just like the “stop if true” box in Excel.) Click OK
     

    Apply Format When Condition Not Met

  6. Click this format and apply whatever format you want. We’ll make the text bold. 
  7. Click entire row and select the Shipment Order Date column. Click OK
     

    Shipment Order Date Condition

     

  8. Now, all dates other than 07/01/15 will be bolded in the Shipment Order Date column.
     

    If Then Shipment Order Date

Step 2: Add Multiple Conditions to a Rule

Just like in Excel, you can use Smartsheet’s built-in formulas when creating conditional formatting rules. However, Smartsheet makes it easy to perform some of the simple functions that basic Excel formulas provide, so you don’t have to worry about remembering complicated formula syntax. To perform the AND function, you can simply click to add multiple conditions to any conditional formatting rule.

  1. Click the conditional formatting icon on the toolbar and click Add New Rule
  2. Click set condition. We want to highlight cells in the Item # list that contain both a ‘B’ and an ‘L.’ Click Item # from the dropdown list on the left.  
  3. For the conditions, select contains and type B. Click into the second prompted condition and type L to create the second condition. (This will perform the AND function.) Click OK.

    Multiple Conditions Rule

  4. Apply the formatting to your rule. We’ll use a yellow fill. 
  5. Change entire row to Item #. Click OK
     

    Item Number Multiple Conditions

  6. Your sheet will now highlight those values in Item # that contain both a B and an L.
     

    Multiple Conditions Smartsheet

You can still use formulas with conditional formatting, if you’d like. For an introduction on how to use formulas, check out this resource.

Step 3: Conditional Formatting Based on Another Cell

Smartsheet also makes it easy to apply conditional formatting based on another cell. Instead of using complicated formulas to reference different cells, you can simply control which cells to pull from and format with a few clicks. 

  1. In this example, we want to highlight the Item Name column if the status bar is red, to call attention to at-risk items. To do this, we’ll create a rule that pulls from the Qty. Status column, but applies formatting to the Item Name column. 
  2. Click the conditional formatting icon on the toolbar and click Add New Rule > set condition.
  3. Click Qty. Status from the drop down list and click Red. Click OK.
     

    Quantity Status Red

  4. Apply a light red paint fill to format with.
  5. Click entire row and select Item name. This will apply formatting to cells in the Item name column, even though we’re pulling information from the Qty. Status column. 
     

    Quantity Status Item Name

  6. Click your new rule and drag it to the top of your rules list. Since we have multiple highlighting rules, this will ensure that this rule takes precedence over others.
     

    Drag Rule to Top

     

  7. Cells in Item Name will now be highlighted if the Qty. Status ball is red. 
     

    Conditional Formatting Hierarcy

Tip: To eliminate visual redundancy, you can hide the Qty. Status column in your sheet. Simply right-click the column and click Hide column. Your sheet will retain its formatting based on that column, but it will look cleaner. 

Hide Column Smartsheet

Step 4: Rule Hierarchy and Precedence

Managing rule hierarchy is quite simple in Smartsheet. The rules also interact the same way as Excel (you can apply multiple rules to a single cell, but only one will show up if there’s a conflict). However, the default precedence is a little different:

  1. Click on the conditional formatting icon to bring up the rules. 
  2. In Smartsheet, rules higher on this list have precedence. So, the rules have descending hierarchy from the top to bottom of the list. 
  3. To change hierarchy, simply click on a rule and drag it up or down.
     

    conditional formatting rule precedence Smartsheet

Frequently Asked Questions About Conditional Formatting

The most commonly asked questions about conditional formatting include queries about who can make changes, where to learn about using formulas, and how to copy conditional formatting rules between sheets. We’ve answered these and other frequently asked questions below: 

Will conditional formatting change the values in my cells?

No. Conditional formatting only applies formatting to your cells. However, you can use conditional formatting to manipulate the values in your cells by using formulas, or by creating rules that change the value of a cell based on another cell.  

Can anyone change or apply conditional formatting to the spreadsheets?

Only one person can update conditional formatting rules in Excel at a time. In Smartsheet, any collaborator with Admin permissions can create or edit conditional formatting, but editors and viewers cannot. Click the Sharing button to adjust permissions.

Does the Office 365 (cloud) version of Excel support conditional formatting?

Users can only view conditional formatting in the cloud version of Excel. To add or edit rules, download the Office 365 desktop version. Be careful of version control issues when working with Office 365. 

I’m not comfortable using Excel formulas. Where can I learn more?

Here is a list of common questions for using Excel formulas with conditional formatting. For a comprehensive list of all Excel formulas, click here. For help with using formulas with conditional formatting in Smartsheet, check out these tips. 

How do I add conditional formatting to a new document in Excel?

To copy conditional formatting to a new workbook or sheet, select the cells you want to copy conditional formatting from, and click the Format Paint icon. Drag your cursor over the column, rows, or document to apply the rules. 

Here’s a walkthrough of this function.

Keep Your Team in Sync with Real Time Conditional Formatting in Smartsheet

Empower your people to go above and beyond with a flexible platform designed to match the needs of your team — and adapt as those needs change. 

The Smartsheet platform makes it easy to plan, capture, manage, and report on work from anywhere, helping your team be more effective and get more done. Report on key metrics and get real-time visibility into work as it happens with roll-up reports, dashboards, and automated workflows built to keep your team connected and informed. 

When teams have clarity into the work getting done, there’s no telling how much more they can accomplish in the same amount of time. Try Smartsheet for free, today.

How do I conditionally format a cell so if not blank it is grey?

I tried to do ‘not equal’, but it didn’t work.

I am using Windows Office 2003 with Windows XP at work. I don’t see the same feature as below:

enter image description here

What I have tried so far:

enter image description here

Edit: Figured what was wrong. In my production (actual work Excel), they were filled with white color. It wasn’t my Excel file, so I was not aware of this before.

pnuts's user avatar

pnuts

58k11 gold badges85 silver badges137 bronze badges

asked May 13, 2013 at 21:03

George's user avatar

5

Does this work for you:

enter image description here

You find this dialog on the Home ribbon, under the Styles group, the Conditional Formatting menu, New rule....

answered May 13, 2013 at 21:07

Floris's user avatar

FlorisFloris

45.7k6 gold badges70 silver badges122 bronze badges

5

You can use Conditional formatting with the option «Formula Is». One possible formula is

=NOT(ISBLANK($B1))

enter image description here

Another possible formula is

=$B1<>""

enter image description here

answered May 14, 2013 at 8:03

teylyn's user avatar

teylynteylyn

34.1k4 gold badges52 silver badges72 bronze badges

4

In Excel 2003 you should be able to create a formatting rule like:

=A1<>"" and then drag/copy this to other cells as needed.

If that doesn’t work, try =Len(A1)>0.

If there may be spaces in the cell which you will consider blank, then do:

=Len(Trim(A1))>0

Let me know if you can’t get any of these to work. I have an old machine running XP and Office 2003, I can fire it up to troubleshoot if needed.

answered May 14, 2013 at 2:10

David Zemens's user avatar

David ZemensDavid Zemens

52.8k11 gold badges79 silver badges129 bronze badges

1

This worked for me:

=NOT(ISBLANK(A1))

I wanted a box around NOT Blank cells in an entire worksheet.
Use the $A1 if you want the WHOLE ROW formatted based on the A1, B1, etc result.

Thanks!

answered Dec 26, 2013 at 16:16

WayneGrantham's user avatar

This method works for Excel 2016, and calculates on cell value, so can be used on formula arrays (i.e. it will ignore blank cells that contain a formula).

  • Highlight the range.
  • Home > Conditional Formatting > New Rule > Use a Formula.
  • Enter «=LEN(#)>0» (where ‘#’ is the upper-left-most cell in your range).
  • Alter the formatting to suit your preference.

Note: Len(#)>0 be altered to only select cell values above a certain length.

Note 2: ‘#’ must not be an absolute reference (i.e. shouldn’t contain ‘$’).

answered May 23, 2018 at 12:48

Finger Picking Good's user avatar

An equivalent result, «other things being equal», would be to format all cells grey and then use Go To Special to select the blank cells prior to removing their grey highlighting.

answered May 14, 2013 at 8:53

pnuts's user avatar

pnutspnuts

58k11 gold badges85 silver badges137 bronze badges

Conditional Formatting is one of the most simple yet powerful features in Excel Spreadsheets.

As the name suggests, you can use conditional formatting in Excel when you want to highlight cells that meet a specified condition.

It gives you the ability to quickly add a visual analysis layer over your data set. You can create heat maps, show increasing/decreasing icons, Harvey bubbles, and a lot more using conditional formatting in Excel.

Using Conditional Formatting in Excel (Examples)

In this tutorial, I’ll show you seven amazing examples of using conditional formatting in Excel:

  • Quickly Identify Duplicates using Conditional Formatting in Excel.
  • Highlight Cells with Value Greater/Less than a Number in a Dataset.
  • Highlighting Top/Bottom 10 (or 10%) values in a Dataset.
  • Highlighting Errors/Blanks using Conditional Formatting in Excel.
  • Creating Heat Maps using Conditional Formatting in Excel.
  • Highlight Every Nth Row/Column using Conditional Formatting.
  • Search and Highlight using Conditional Formatting in Excel.
1. Quickly Identify Duplicates

Conditional formatting in Excel can be used to identify duplicates in a dataset.

Here is how you can do this:

This would instantly highlight all the cells that have a duplicate in the selected data set. Your dataset can be in a single column, multiple columns, or in a non-contiguous range of cells.

Conditional Formatting in Excel - Single Multiple Columns

See Also: The Ultimate Guide to Find and Remove Duplicates in Excel.
2. Highlight Cells with Value Greater/Less than a Number

You can use conditional formatting in Excel to quickly highlight cells that contain values greater/less than a specified value. For example, highlighting all cells with sales value less than 100 million, or highlighting cells with marks less than the passing threshold.

Here are the steps to do this:

This would instantly highlight all the cells with values greater than 5 in a dataset.Conditional Formatting in Excel - greater than 5 highlightedNote: If you wish to highlight values greater than equal to 5, you should apply conditional formatting again with the criteria “Equal To”.

The same process can be followed to highlight cells with a value less than a specified values.

3. Highlighting Top/Bottom 10 (or 10%)

Conditional formatting in Excel can quickly identify top 10 items or top 10% from a data set. This could be helpful in situations where you want to quickly see the top candidates by scores or top deal values in the sales data.

Similarly, you can also quickly identify the bottom 10 items or bottom 10% in a dataset.

Here are the steps to do this:

This would instantly highlight the top 10 items in the selected dataset. Note that this works only for cells that have a numeric value in it.

Also, if you have less than 10 cells in the dataset, and you select the options to highlight Top 10 items/Bottom 10 Items, then all the cells would get highlighted.

Here are some examples of how the conditional formatting would work:

Conditional Formatting in Excel - Top bottom example

4. Highlighting Errors/Blanks

If you work with a lot of numerical data and calculations in Excel, you’d know the importance of identifying and treating cells that have errors or are blank. If these cells are used in further calculations, it could lead to erroneous results.

Conditional Formatting in Excel can help you quickly identify and highlight cells that have errors or are blank.

Suppose we have a dataset as shown below:

Conditional Formatting in Excel - Error dataset

This data set has a blank cell (A4) and errors (A5 and A6).

Here are steps to highlight the cells that are empty or have errors in it:

This would instantly highlight all the cells that are either blank or have errors in it.

Conditional Formatting in Excel - errors highlightedNote: You don’t need to use the entire range A1:A7 in the formula in conditional formatting. The above-mentioned formula only uses A1. When you apply this formula to the entire range, excel checks one cell at a time and adjusts the reference. For example, when it checks A1, it uses the formula =OR(ISBLANK(A1),ISERROR(A1)). When it checks cell A2, it then uses the formula =OR(ISBLANK(A2),ISERROR(A2)). It automatically adjusts the reference (as these are relative references) depending on which cell is being analyzed. So you need not write a separate formula for each cell. Excel is smart enough to change the cell reference all by itself 🙂

See Also: Using IFERROR and ISERROR to handle errors in excel.
5. Creating Heat Maps

A heat map is a visual representation of data where the color represents the value in a cell. For example, you can create a heat map where a cell with the highest value is colored green and there is a shift towards red color as the value decreases. 

Something as shown below:

Conditional Formatting in Excel - heatmap

The above data set has values between 1 and 100. Cells are highlighted based on the value in it. 100 gets the green color, 1 gets the red color.

Here are the steps to create heat maps using conditional formatting in Excel.

  • Select the data set.
  • Go to Home –> Conditional Formatting –> Color Scales, and choose one of the color schemes.Conditional Formatting in Excel - heatmap colors

As soon as you click on the heatmap icon, it would apply the formatting to the dataset. There are multiple color gradients that you can choose from. If you are not satisfied with the existing color options, you can select more rules and specify the color that you want.

Note: In a similar way, you can also apply Data Bard and Icon sets.

6. Highlight Every Other Row/Column

You may want to highlight alternate rows to increase the readability of the data.

These are called the zebra lines and could be especially helpful if you are printing the data.

Now there are two ways to create these zebra lines. The fastest way is to convert your tabular data into an Excel Table. It automatically applied a color to alternate rows. You can read more about it here.

Another way is using conditional formatting.

Suppose you have a dataset as shown below:

Conditional Formatting in Excel - Alternate Data

Here are the steps to highlight alternate rows using conditional formatting in Excel.

That’s it! The alternate rows in the data set will get highlighted.

Conditional Formatting in Excel - Alternate rows final

You can use the same technique in many cases. All you need to do is use the relevant formula in the conditional formatting. Here are some examples:

  • Highlight alternate even rows: =ISEVEN(ROW())
  • Highlight alternate add rows: =ISODD(ROW())
  • Highlight every 3rd row: =MOD(ROW(),3)=0
7. Search and Highlight Data using Conditional Formatting

This one is a bit advanced use of conditional formatting. It would make you look like an Excel rockstar.

Suppose you have a dataset as shown below, with Products Name, Sales Rep, and Geography. The idea is to type a string in cell C2, and if it matches with the data in any cell(s), then that should get highlighted. Something as shown below:

Conditional formatting in Excel - search and highlight demo

Here are the steps to create this Search and Highlight functionality:

That’s it! Now when you enter anything in cell C2 and hit enter, it will highlight all the matching cells.

How does this work?

The formula used in conditional formatting evaluates all the cells in the dataset. Let’s say you enter Japan in cell C2. Now Excel would evaluate the formula for each cell.

The formula would return TRUE for a cell when two conditions are met:

  • Cell C2 is not empty.
  • The content of cell C2 exactly matches the content of the cell in the dataset.

Hence, all the cells that contain the text Japan get highlighted.

Download the Example File
Download File

You can use the same logic, to create variations such as:

  • Highlight the entire row instead of a cell.
  • Highlight even when there is a partial match.
  • Highlight the cells/rows as you type (dynamic) [You are going to love this trick :)].

How to Remove Conditional Formatting in Excel

Once applied, conditional formatting remains in place unless you remove it manually. As a best practice, keep the conditional formatting applied only to those cells where you need it.

Since it’s volatile, it may lead to a slow Excel workbook.

To remove conditional formatting:

  • Select the cells from which you want to remove conditional formatting.
  • Go to Home –> Conditional Formatting –> Clear Rules –> Clear Rules from Selected Cells.
    • If you want to remove conditional formatting from the entire worksheet, select Clear Rules from Entire Sheet.Conditional Formatting in Excel - Clear Rules
Important things to know about Conditional Formatting in Excel
  • Conditional formatting in volatile. It can lead to a slow workbook. Use it only when needed.
  • When you copy paste cells that contain conditional formatting, conditional formatting also gets copied.
  • If you apply multiple rules on the same set of cells, all rules remain active. In the case of any overlap, the rule applied last is given preference. You can, however, change the order by changing the order from the Manage Rules dialogue box.

You May Also Like the Following Excel Tutorials:

  • The Right Way to Apply Conditional Formatting in Pivot Table
  • Find and Remove Duplicates in Excel
  • The Ultimate Guide to Using Conditional Formatting in Google Sheets
  • How to Highlight Weekend Dates in Excel?

Conditional formatting is a convenient tool for data analysis and visual representation of results. Knowing how to use this tool will save you a lot of time and effort. A fleet glance at the document will be enough to obtain the necessary information.



How to apply conditional formatting in Excel

The tool «HOME»-«Conditional formatting» can be found on the main tab in the «Styles» section. If you click on the little arrow on the right, it will open the menu.

click on the little arrow.

Let’s compare the numerical values in an Excel range with a numerical constant. The rules «Greater Than / Less Than / Equal To / Between…» are the most frequently used. That’s why they’re listed in the menu «Highlight Cells Rules».

Let’s enter some numbers in the range А1:А11.

numbers in the range.

Select the range of values. Open the menu «Conditional formatting». Select «Highlight Cells Rules». Set a condition, for example, «Greater Than».

Highlight Cells Rules.

Let’s enter the number 15 in the left box. In the drop-down menu on the right select the way of highlighting the values that correspond to the established condition: «Format cells that are GREATER THAN:» 15. The result is plain to see immediately:

GREATER THAN.

Leave this menu by hitting the OK button.



Conditional formatting by a cell’s value

Let’s compare the values in the range А1:А11 with the number in the B2 cell. Enter the number 20 in it.

Select the initial range and open the window of the «Conditional formatting» tool. In this example, let’s apply the condition «less» («Highlight Cells Rules» — «Less Than»).

In the left box, enter the link to the B2 cell (click on this cell and its name will appear in the box automatically). The link’s absolute by default.

The formatting result is plain to see in the Excel sheet immediately.

result is plain.

The values in the А1:А11 range that are less than the value of the B2 cell are filled with the selected color.

Let’s set the following formatting conditions: compare the values of cells in different ranges and highlight the same values. We will compare the column А1:А11 with the column В1:В11.

Select the initial range (А1:А11). Click «Conditional formatting» — «Highlight Cells Rules» — «Equal To». In the left box, enter the link to the B1 cell. The link should be Mixed or Relative! And not absolute!

Equal To.

The program has compared every value in the A column with the corresponding value in the B column. The coinciding values have been highlighted with a fill color.

Important note! When you use relative references, you have to pay attention to which cell was active the moment you opened the «Conditional formatting» tool. Since it’s the active cell to which the reference in the condition is “tied.”

In our example, the A1 cell was active at the moment we opened the tool. The link is $B1. Consequently, Excel compares the value in the A1 cell with the B1 value. If we selected the column from the bottom upwards rather than from top to bottom, the A11 cell would be the active one. And the program would compare B1 with A11.

Compare:

Compare.

Pay attention to this nuance in order to ensure the «Conditional formatting» tool performs the task properly.

You can do the following to check the accuracy of the established condition:

  1. Select the first cell in the range to which conditional formatting is applied.
  2. Open the tool’s menu; click «Manage Rules».

open the tool's menu.

In the newly-opened window, you can see which rule is applied to which range.

Conditional formatting – several conditions

The initial range is А1:А11. We need the numbers that are greater than 6 to be highlighted with red. Green for numbers greater than 10. Yellow for values greater than 20.

  1. Method: Select the range А1:А11. Apply «Conditional formatting» to it. «Highlight Cells Rules» — «Greater Than». Enter the number 6 in the left box. In the right one, select «Light Red Fill Dark Red Text». Hit OK. Select the range А1:А11 once again. Set the formatting condition as «Format cells that are GREATER THAN:» 10, and choose «Green Fill Dark Green Text». In the same way, set the yellow fill color for numbers greater than 20.
  2. Green Fill Dark Green Text.

  3. Method: Go to the menu of the «Conditional formatting» tool and select «New Rule». Fill in the formatting parameters for the first condition. Click OK. Likewise, set the second and third formatting conditions:

formatting conditions.

Note: the values in some cells simultaneously corresponds to two or more conditions. The highlighting priorities depend on the order of the rules listed in «Rules Manager».

highlighting priorities.

That is, the number 24, which is simultaneously greater than 6, 10, and 20, is highlighted in accordance with the condition «=$А1>20» (the first one on the list).

Conditional formatting of dates in Excel

Select the range containing the dates.

the dates.

Apply «Highlight Cells Rules»-«A Date Occurring» to it.

A Date Occurring.

In the newly-opened window, you can seen the list of available conditions (rules):

for the last 7 days.

Select the suitable one (for instance, for the last 7 days) and click OK.

done.

The red fill color highlights the cells containing the dates within the past week (the date when this article was written is March 3, 2017).

Conditional formatting in Excel using formulas

If the standard rules are not sufficient for the task, the user can apply a formula. The capabilities of this instrument are limitless, so virtually any formula can be used. Let’s view a simple variant.

We have a column containing numbers. We need the cells with even numbers to be highlighted with a color. We will use the formula: =MOD(A1,2)

Select the range containing the numbers and open the «Highlight Cells Rules» menu. Select «New Rules». Click «Use a formula to determine which cells to format». Fill in the box as follows:

Fill in the box as follows.

Click Ok to close the window and view the result.

Conditional formatting of the row by a cell’s value

The task is to highlight the row containing a cell with a certain value.

The exemplary table:

exemplary table.

We need to highlight in red the information on the projects in progress («Underway»). For the completed projects’ data («Completed»), the green fill in color should be applied.

Select the range containing the table values A2:D12. Click «Highlight Cells Rules»-«New Rule». Choose a formula as the type of condition. We will use the function: =IF().

The order of filling in the formatting conditions for «Completed projects».

Underway:

Completed:

Underway.

Note: links to a row are absolute; links to a cell are mixed (only the column is fixed).

Likewise, set the formatting rules for the projects in progress.

In «Rules Manager», the conditions appear as follows:

Rules Manager.

The obtained result:

obtained result.

When the formatting parameters are set for the entire range, the condition will be fulfilled as soon as the cells are filled in. For example, let’s complete Caroline project dated January 28 by replacing «Underway» with «Completed».

The highlight has changed automatically. It would have taken you a while to achieve this result using the standard Excel tools.

Combine conditional formatting with an IF statement

Syntax 

=IF (logical_test, [value_if_true], [value_if_false])

But in conditional formatting, IF/THEN/ELSE syntax cannot be applied in a single rule. Conditional formatting is applied using IF/THEN logical test only. It must return TRUE for conditional formatting to be applied.

For example, if you want to apply conditional formatting using a condition that “If a cell value is greater than a set value, say 100, then format the cell as RED, else format the cell as GREEN”. So, you can see that it requires two rules to perform the conditional formatting, one for greater than 100, and one for less than 100.

You can apply more than one condition by creating more than one rule in conditional formatting. You can also use logical functions like AND and OR to create a rule set and apply conditional formatting in Excel.

Examples using conditional formatting with IF/THEN conditions

Let’s look at the scenarios to see how to use IF/THEN logical test in conditional formatting to highlight the targeted values. If you want to highlight the invoices in data range of A2:C13 which are due in the month of April, then you need to test the IF/THEN logical condition on date range in column B, if the month is equal to April, by using following custom formula in conditional formatting.=MONTH($B2)=4

First, select the data range A2:C13, then go to:

Conditional Formatting (on the Home tab) > New Rule> Use a formula to determine…> Enter the above formula in Edit Rule Description window> Choose the Format Fill to preview and press OK

How to Combine Conditional Formatting with an IF Statement

Please note that you have to fix the column by making it absolute using $ sign with it, and keep the row number free or relative to change. Hence, the formula will check each row of the specified column in the selected range, test the IF/THEN logical condition and will return TRUE and FALSE.

This rule will be evaluated in all active cells of locked column B one by one ignoring other cells in columns A and C. When the MONTH function in a cell of column B returns number 4 (April), the rule will return TRUE for all the active cells in that row and conditional formatting will be applied to that entire row as shown below.

How to Combine Conditional Formatting with an IF Statement

Now, if you want to conditionally highlight the two largest amount invoices due in the month of April, then you can achieve this by creating a rule set based on array formula using AND, LARGE and IF statement as per the following syntax.

=AND(criteria,$C2>=LARGE (IF(criteria, values),2)) =AND(MONTH($B2)=criteria,$C2>=LARGE (IF(MONTH(date)=criteria, amount),2)) =AND(MONTH($B2)=4,$C2>=LARGE(IF(MONTH($B$2:$B$13)=4,$C$2:$C$13),2))

By applying this custom formula, you can highlight the two largest amount invoices in the month of April. LARGE with IF function will generate a series of values and compare them with each value in column C. AND function will test the logical conditions in each cell of column B and C both one by one and will return TRUE where both conditions will be met. Have a look below.

How to Combine Conditional Formatting with an IF Statement

Need some additional help with Conditional Formatting or have other questions about Excel? Connect with a live Excel expert here for some 1 on 1 help. Your first session is always free. 

Are you still looking for help with the Average function? View our comprehensive round-up of Average function tutorials here.

Skip to content

How to Use Conditional Formatting to Highlight Text in Excel

How to Use Conditional Formatting to Highlight Text in Excel

Conditional formatting in Excel is formatting that changes with the cell content.

That means you don’t have to change it when the cell content changes.

You use conditional formatting to make it easier for the user to identify key points of interest.

That could be:

  • All cells that contain the name of a certain employee
  • All rows regarding a certain order number

Or a lot of other things.

Follow this step-by-step guide and learn to highlight text with conditional formatting in Excel.

And a bit more😉

Download the workbook I use in this guide if you want to tag along.

Highlight text with conditional formatting

The reason for highlighting text with conditional formatting is to draw the user’s attention to those cells – so they find relevant information faster🏃

You apply conditional formatting with what is called conditional formatting rules.

It’s really easy to insert one of those.

1. Select all the cells where the text you want to highlight can be.

In the sample data, I want to identify all L compatible adapters. So, I select all cells in column B (from cell B2 and down).

Conditional formatting in Excel - Selected cells for highlight cells rules

2. In the middle of the Home tab, click ‘Conditional Formatting’.

Click conditional formatting button in Excel

3. Hover your cursor over ‘Highlight Cells Rules’ and select ‘Text that Contains’.

Conditional formatting in Excel - click highlight cells rules

4. In the dialog box that appears, write the text you want to highlight, in the left field.

Conditional formatting in Excel - Write text for criteria

As you type it, you can see the conditional formatting applied instantly.

The formatting being applied is the standard conditional formatting format.

5. To change the format, click the drop-down arrow in the right field and select another of the formatting presets.

6. Or you can create your own format by clicking ‘Custom format’.

Conditional formatting in Excel - Custom formatting style

7. After clicking ‘Custom Format’ the ‘Format Cells’ dialog box appears.

This is the same as the normal ‘Format Cells’ dialog box you’re using when you apply normal formatting in a spreadsheet.

Use whatever formatting style you want for your conditional formatting rule.

Conditional formatting in Excel - Format cells to get your formatting style

And that’s it!

Now, all cells containing the text “L compatible” are highlighted with the chosen formatting.

Conditional formatting in Excel - highlight cells

Because conditional formatting is dynamic, it changes when the data changes. So if the content of a cell changes from whatever to “L compatible” that cell gets highlighted too.

Kasper Langmann, Microsoft Office Specialist

Highlight numbers with conditional formatting

Sometimes you’re not reading all your data in your sheets, you’re just looking for specific numbers.

That can be a tedious process, especially if you have a large data set.

Let’s dive into our inventory list again🤿

If the quantity in stock of an item reaches below 100 it’s critical that you find out, so you can buy more units of that particular item.

Let’s make a simple conditional formatting rule to highlight cells.

1. Select the cells in the quantity column (cells C2 and down).

Conditional formatting in Excel - select quantity cells

With those selected cells, we need to apply a ‘Highlight Cells’ conditional formatting rule.

2. In the Home tab of the ribbon, click ‘Conditional Formatting’.

Click conditional formatting in Excel

3. Hold your cursor over ‘Highlight Cells Rules’ and click ‘Less than’.

Click Conditional formatting in Excel - highlight cells rules

This conditional formatting rule allows you to apply conditional formatting if the value of a cell is less than what you’re defining in a few seconds.

4. In the left field, write the number the cell value should be less than to apply conditional formatting.

Click Conditional formatting in Excel - click highlight cells rules less than value

As you type, you can see the format of this conditional formatting rule being applied to the selected cells.

Right now, it’s just the standard format: Light Red Fill with Dark Red Text.

Classic👍

5. In the right field, click the drop-down button if you want to change to another formatting preset.

Choose formatting for the highlighted cells

6. Or you can click ‘Custom Format’ to control the formatting style 100%.

Conditional formatting - format cells box

And that’s it.

Watch all the values below 100 being highlighted automatically. Beautiful, isn’t it?💕

Conditional formatting in Excel - highlight values

This conditional formatting rule can be modified to other situations if you take a step back.

For instance, you can turn it upside down and highlight cells that are above 100.

Or cells with values between 50 and 150.

The possibilities are almost endless.

Highlighting entire rows based on a formula

Entire rows look nice when they are formatted in a certain way. Instead of random colored cells everywhere.

So, let me show you how to color an entire row with a conditional formatting rule if the value in column C is less than 100👀

1. Select the entire data set. The selected cells indicate how much of each row is highlighted by the conditional formatting rule.

2. Click ‘Conditional Formatting’ on the Home tab and click ‘New Rule.’

Click conditional formatting in Excel - new rule

3. In the dialog box that appears, select ‘Use a formula to determine which cells to format’ from the ‘Rule Type’ menu.

Conditional formatting in Excel - new rule from formula

4. Right below, enter this formula:

=$C1<100

So, if the value in column C drops below 100, the conditional formatting rule triggers.

You can’t refer to entire columns, so you need to refer to C1. NOT C2, although it seems more logical⚙️

If your data starts in row 3, 5, 10, or whatever other row, the reference still goes to C1 (or whatever column you’re using).

5. Now chose your formatting style from the ‘Custom Format’ button.

Or settle for the standard preset.

And behold!

All the cells in your data rows are now formatted, and not just in 1 column like they typically are with conditional formatting.

Conditional formatting in Excel - highlight entire row based on value

Editing and removing conditional formatting rules

The layout and use of a workbook are rarely static, so the conditional formatting that you apply to your sheet may have to be edited at some point.

For instance, the previous highlight cells rules we set… Maybe it’s time to change them.

Luckily that’s fairly easy.

You can edit any conditional formatting rule from the conditional formatting rules manager.

Edit the conditional formatting rule and formatting style

1. Click ‘Conditional Formatting’ from the Home tab and select ‘Manage Rules’.

Click conditional formatting and Manage Rules

After you click ‘Manage Rules…’ you’ll see a ‘Conditional Formatting Rules Manager’ dialog box.

Change the following 3 points as you see them on in the manager.

2. Set ‘Show formatting rules for:’ to ‘This Worksheet’ to show all conditional formatting rules for the entire sheet.

3. Find the rule you want to edit (there might be several on the list).

4. Click the ‘Edit Rule’ button.

Conditional formatting rules manager

Another dialog box appears. From here you can change anything about the rule.

Conditional formatting - Edit formatting rule dialog box

Below we’ll go through the different options shown in the screenshot above.

Circle 1) Here you can change the ‘Rule Type’. If you don’t want to apply conditional formatting when “something” happens in a cell, you can change it to apply on all cells and fill them with color based on their value compared to the average of the data.

Circle 2) If you keep the ‘Rule Type’ you can change the “trigger” of the formatting. The trigger depends entirely on which type of conditional formatting rule you choose in circle 1. In this case, you can change the custom formula.

Circle 3) From this little (familiar) box you can change the formatting that you applied in the first place. If you don’t want your cells to turn yellow when it drops below cell value: 100, you can have them turn purple instead.

As you see there are more than enough options.

But wait – there’s more!

Edit the conditional formatting rules range

All of the above is very nice, but if you accidentally selected the wrong area when you made the conditional formatting rule – then it doesn’t help to change the ‘Rule Type’ or whether the cells should be red or blue.

And if you spent 5 minutes entering a unique formula to “trigger” the formatting, then it sucks to delete it and do it all over.

To change the range of cells that the conditional formatting applies to, you don’t need to go to the ‘Edit Rule’ box above.

You just need to click in the ‘Applies to’ column at the rule you want to change in the ‘Conditional Formatting Rules Manager’ box.

Conditional formatting edit selected range

If you can’t remember the range that the rule should apply to, click the tiny red arrow to select the range manually.

That’s how you edit a conditional formatting rule✏️

So if you screw one up?

You don’t have to delete it – simply just edit it.

Delete a conditional formatting rule

Sometimes you see a workbook with too many conditional formatting rules.

This can create immense confusion and on top of that, it can make your workbook slow.

In this case, you need to remove conditional formatting from the spreadsheet. Maybe even all of it!

Click the ‘Conditional Formatting’ button on the ‘Home’ tab and hover your mouse over ‘Clear Rules’.

Click conditional formatting clear rules

Then click ‘Clear Rules from Entire Sheet’.

That was pretty easy. But it’s not always clever to clear all conditional formatting rules from a sheet!

Sometimes some rules should still apply.

To select specifically which conditional formatting rules are to be removed, click ‘Manage Rules…’ instead.

Click manage rules to start to clear rules

Here you’ll find the conditional formatting rules manager dialog box that you can use to clear rules, in addition to editing rules.

To delete specific conditional formatting rules:

Click on 'Delete Rule' from 'Rules Manager' dialog box to clear conditional format
  1. Click the drop-down arrow that initially says “Current Selection”. Change it to “This Worksheet”.
  2. Select the conditional formatting rule you don’t want anymore.
  3. Press ‘Delete Rule’ to actually clear rules.

Remember to click OK when you’re done.

And that’s how you actually clear rules✏️

That’s it – Now what?

That’s how to highlight cells with conditional formatting.

Like all the cells that contain a specific word or a number.

Heck, you even learned how to remove conditional formatting, create a new rule from a formula, and much more.

Well done💪

Conditional formatting is a part of Excel that can think for itself. Meaning it makes its own decisions. It “reads” the cell and reacts on the content.

There are several other parts of Excel that react to the content of cells – just like conditional formatting does.

And you most definitely want to learn those parts.

So, I’ve made a free course teaching you 2 of the best conditional functions Excel has to offer: IF and SUMIF.

Also, you learn VLOOKUP and pivot tables.

Click here to enroll in my free 30-minute course and I’ll send it to your inbox right away.

Frequently Asked Questions

If you’re looking for a specific answer to a specific question, please see the FAQ section below. Maybe you’ll find what you need😊

Conditional Formatting is formatting that changes when the cell that it’s based on changes.

This is very different from normal formatting which is static and does not change unless you make the change yourself.

For example, you can make a cell change color when its content drops below 100.

Conditional formatting is located on the Home tab on the Ribbon in Excel. The Ribbon is the main menu, on the top of your screen, where most Excel features are accessible from buttons.

Select your data and click the conditional formatting button to use any of the conditional formatting rules.

Yes, you can use the format painter to copy and paste conditional formatting quite easily.

Select the cells with conditional formatting and from the Home tab, click the ‘Format painter‘ button.

Then select the cells where you want to paste conditional formatting.

Kasper Langmann2023-02-23T11:25:29+00:00

Page load link

How to Use Conditional Formatting in Excel

Conditional formatting is one of my favorite features in both Excel and Google Sheets. I love the way it can make a boring hard-to-interpret spreadsheet more interesting and easier to use.

Conditional formatting is mostly used for data analysis, such as adding color scales, highlighting high and low values, identifying duplicates, and marking outliers. Conditional formatting can be also used for graphical interface elements such as progress bars, graying out completed tasks, changing number formats, or displaying a gantt chart.

In this article, I’ll show over 20 different ways that you can use conditional formatting, starting with some basics and presenting some advanced techniques as well. Many of the examples come from templates that you can download and experiment with.

Download the Example File (ConditionalFormatting.xlsx)

This Article (bookmarks):

  • What is Conditional Formatting?
    • How to Highlight Duplicates
    • How to add Color Scales
    • How to add Data Bars in Excel
    • Highlight Overdue Dates
    • How to add Icon Sets in Excel
  • How to View and Edit Conditional Formatting Rules
  • Rule Order Matters
  • How to create an In-Cell Progress Bar
  • How to Highlight Every Other Row
  • Conditional Formatting Based on Another Cell
  • How to create a Formula Rule
    • How to Highlight an Entire Row
    • How to Highlight Based on a Range
    • How to Highlight Values NOT in a Range
  • Create a Gantt Chart
  • Use Data Bars to Compare Two Groups
  • Control Scaling by Linking Min/Max to Cells
  • Change Number Formatting with CF Rules
    • Change Date Formats to d/m/yyyy
    • Hide Zero Values
    • Automatic Indenting
    • Display 23K, 23M, 23B Based on Value
    • Display Custom Icons
  • How to Copy Conditional Formatting
  • Conditional Formatting is Volatile

What is Conditional Formatting?

How to Apply Conditional Formatting in Excel

Conditional Formatting in a spreadsheet allows you to change the format of a cell (font color, background color, border, etc.) based on the value in a cell or range of cells, or based on whether a formula rule returns TRUE.

To Apply Conditional Formatting in Excel: First, select the cells you want to format. Then, go to Home > Conditional Formatting and select an option from the built in menu, or click on Manage Rules.

To Apply Conditional Formatting in Google Sheets: First, select the cells you want to format. Then, go to Format > Conditional Formatting and click on «Add another rule» in the side panel.

NOTE Google Sheets currently provides fewer conditional formatting options and controls than Excel (for example, no data bars or icon sets). The focus of this article will be on how to use conditional formatting in Excel, but many of the techniques will apply just as readily to Google Sheets.

Here are a few things you can do with the built-in options in Excel:

1. How to Highlight Duplicates

Conditional Formatting Example: Highlight Duplicates

Select your range of cells, then go to Home > Conditional Formatting > Highlight Cells Rules > Duplicates.

After viewing the duplicates, you can decide whether you need to remove them manually or use the built-in tool via Data > Data Tools > Remove Duplicates.

Highlighting duplicates in Google Sheets requires using a custom formula rule such as =COUNTIF(A:A,A1)>1 to highlight the duplicates in column A.

2. How to add Color Scales

Conditional Formatting Example: Color Scales

Select your range of cells, then go to Home > Conditional Formatting > Color Scales and pick the color range that makes sense (usually, green=good and red=bad).

Color Scales are very useful for seeing high and low values within a large data set. Color Scales can also be used to create heat maps, like this Calendar Heat Map Chart:

Calendar Heat Map Chart

3. How to add Data Bars in Excel

Conditional Formatting Example: Data Bars

Select your range of cells, then go to Home > Conditional Formatting > Data Bars and select the style you want.

Data Bars let you create horizontal bar charts and progress bars directly within a group of cells. In the example on the right, I’m using data bars to show a histogram of class grades.

The default settings for Data Bars scale the bars automatically based on the values in the Applies To range. You can control the scale used for the bars by editing the rule’s settings. I’ll be showing a couple examples of that later in this article.

4. How to Highlight Overdue Dates

Conditionally Format Overdue Dates - Calibration Log Example

To highlight overdue dates:

  1. Select the range of dates and go to Home > Conditional Formatting > Highlight Cells Rules > Less Than…
  2. Enter =TODAY()+30 to highlight dates earlier than 30 days from now. Enter =TODAY() to highlight dates earlier than today.
  3. Choose a format option from the drop-down box, then click on OK.

Conditional Formatting to Highlight Overdue Dates

Examples of this technique can be found in the Equipment Calibration Log and To Do List templates.

5. How to Add Icon Sets in Excel

Conditional Formatting Example: Icon Sets

To add Icon Sets, select your data and then go to Home > Conditional Formatting > Icon Sets > and choose one of the options. You will amost always have to customize the settings for Icon Sets.

This example, based on the Checkbook Register Template, uses a green circle icon () to show when an account balance is >=$500, yellow/orange () when it is less than $500, and red () when the balance is negative.

After selecting the icon set from the built-in menu, you need to edit the rule to define these different values. To do that, select one of the cells in the Balance column, go to Home > Conditional Formatting > Rules Manager and click on Edit Rule. The image below shows the settings used in this example:

Icon Sets - Account Balance Example Settings

TIP: One of the best ways to learn how Icon Sets work is to play with all of the different drop-down options in the rule settings.

For examples of other Icon Sets, check out the Feature Comparison Template:

Feature Comparison Template - Examples of Icon Sets

How to View/Edit Conditional Formatting Rules

Vertex42 has many templates that use both simple and advanced conditional formatting techniques. If you are using a template and want to figure out how the conditional formatting works, or want to delete or change rules, you will need to know a couple of things:

1) To view the rules for selected cells, go to Home > Conditional Formatting > Rules Manager

2) To view ALL the rules in the entire worksheet, select «This Worksheet» from the drop-down at the top of the Rules Manager window.

Conditional Formatting Rules Manager

The image above shows the 5 rules used in the Task Checklist Template. The first rule changes tasks to gray strike-through when the Done column has a check mark. The next 3 rules highlight specific text in the Priority column. The last rule adds a Progress Bar in the % Complete column.

Conditional Formatting - Task Checklist Example

I will be using this template to demonstrate some techniques and key facts about conditional formatting, so I would recommend that you download it and experiment with it as you continue to read.

Rule Order Matters

The Task Checklist Template mentioned above demonstrates two key points about rule order or heirarchy.

Key Points

  1. Conditional formatting rules are evaluated one at a time starting with the rule listed at the top.
  2. A later rule cannot override the formatting already modified by a preceding rule.

Here is the list of rules again:

The 5 Rules Used in the Task Checklist Template

Key Point #2 means that if the first rule has already changed the font color to gray, the following rules cannot change the font color to green, yellow, or red. It’s first come, first serve.

In Excel, the font color and fill color (and border, and font style, and …) can be affected independently by different rules. This means that you can have one rule that changes a font to gray, a different rule that changes the cell color to red, and a different rule that adds a data bar.

Why do I need to check the Stop-If-True box?

With the Stop-If-True box checked, none of the following rules will be evaluated if the condition of that first rule is met.

That is why the first task row doesn’t show a Data Bar in the %Complete column and why the Priority «HIGH» is not highlighted red.

What would happen if I didn’t check the Stop-If-True box? Go ahead and try it … or look at the next image.

Conditional Format Example, Stop-if-True Not CheckedResult when Stop-if-True is Not Checked

Notice how the red fill color is applied to the HIGH cell. The first rule does not define a fill color, but it does change the font color. That means that the 4th rule can change the fill color to light red, but it can’t override the font color.

Excel vs. Google Sheets: In Excel, the Number Format, Font Color, Font Style, Font Underline, Font Effects, Fill Color, Fill Effects, Border Color, Border Style, Data Bars, and Icon Sets can be affected independently by different rules. That isn’t the case in Google Sheets. In Google Sheets, conditional formatting behaves as though all rules are Stop-If-True. Excel is much more flexible and powerful in that respect.

How to Create an In-Cell Progress Bar

Create a Progress Bar Using Conditional Formatting

You’ve already seen how to add a Data Bar, so using a Data Bar for showing progress based on a percentage is as simple as making a few changes to the Data Bar settings.

To see how it works in the Task Checklist template, go to Home > Conditional Formatting > Manage Rules, click on the Data Bar rule, then click on the Edit Rule button.

Conditional Format Settings for a Progress Bar in Excel

The progress should be a value between 0% and 100%. When you create a progress bar, you need to change the Minimum value to Type:Number & Value:0, and change the Maximum to Type:Number & Value:1.

NOTE Google Sheets currently doesn’t provide an in-cell data bar option. But, you can mimic the effect using the formula =REPT(«█»,ROUND(percent*10,0)).

I’ve attempted to figure out a way to change the color of the data bars conditionally, but the best I’ve been able to come up with instead is to use a 3-color scale in addition to a gray data bar. This can help if you want to use the color to signal an incomplete task.

Conditional Data Bars Using 3-Color Scale

How to Highlight Every Other Row Using a Formula

Conditional Format Example To Highlight Every Other Row

Highlighting every other row can help make tables more readable like in the expense tracking example. To do this in Excel (without needing the Tables feature), you can create a formula-based conditional formatting rule.

Highlight Every Other Row Using Conditional Formatting

  1. Select the cells you want to format (except the header).
  2. Go to Home > Conditional Formatting > New Rule.
  3. Select «Use a formula to determine which cells to format.»
  4. Enter the formula =MOD(ROW(),2)=0.
  5. Click on Format then select a color in the Fill tab.

Likewise, to highlight every other column, you could use the formula =MOD(COLUMN(),2)=0.

This technique allows you to insert and copy/paste rows without having to update the background colors manually, but it has one major drawback: conditional formatting overrides manual formatting.

Key Point: Conditional formatting overrides manual formatting.

This means that if you want to change the fill color of a cell in your table, but the conditional formatting rule is already changing the fill color, you won’t see the change that you are making. You ARE editing the fill color, but you won’t see the change because conditional formatting is overriding your format.

If you want to manually change the fill colors in your table AND highlight every other row, you may need to use the Format as a Table feature in Excel.

NOTE Google Sheets has a feature listed right underneath Conditional Formatting called Alternate Colors. This works separate from conditional formatting and DOES NOT override custom formatting! I LOVE that!

Conditional Formatting Based on Another Cell

To change the format of a cell based on another cell, or based on a range of cells, use a formula rule to determine which cells to format. Formulas can be simple or very complex. You can use most of the standard spreadsheet functions such as IF(), AND(), MATCH(), SEARCH(), COUNTIF(), SUMIF(), etc.

How to Create a Formula Rule

How to Create a Formula-Based Conditional Formatting Rule in Excel

To create a formula rule, select «Use a formula to determine which cells to format» after clicking on New Rule from the Conditional Formatting menu or from within the Rule Manager.

A formula rule is activated when the formula returns TRUE.

For example, =G27<TODAY() will apply the format when the date in cell G27 is overdue (less than today’s date).

To format based on multiple conditions, use the AND() function in your formula. For example, =AND(A1>10,A1<20) will apply a format when cell A1 is between 10 and 20.

Formula Rules can be very tricky! When using relative references (references without dollar signs in front of the column letter or row number), you need to write your formula based on the top-left cell in the Applies To range. When you are creating the rule for the first time, write your formula based on the top-left cell that you have selected.

IMPORTANT: Always write the formula based on the top-left cell in the Applies To range!

How to Highlight an Entire Row

The Work Breakdown Structure template shows an example of highlighting an entire row when the value in the Level column is equal to 1.

How to Highlight an Entire Row Based on One Cell

The formula we are using is =($B6=1), and this applies to all the cells in the range $B$6:$G$30. One formula to rule them all! But how does it work?

Behind the scenes, Excel is essentially copying this formula to each of the cells in the Applies To range. When a formula is copied, relative references (no dollar sign) will change. This means that for cell C15, the formula would become =($B15=1). Column B stays the same (because of the dollar sign in front of the B), but the row changes.

Key Point: In Conditional Formatting Rules, absolute references stay the same ($B$1) and relative references (A1) change as Excel applies the formula to each cell in the Applies To range.

If you aren’t familiar with how absolute and relative references work, you may want to learn more about that. It’s absolutely critical for understanding formula-based conditional formatting.

How to Highlight Cells Based on a Range

You can use the MATCH() function within a conditional formatting formula rule to highlight cells whose values are found in another range or list.

For example, in the Yearly Event Calendar, dates are highlighted in the calendar if the date is found in the list of holidays, as shown in the image below.

Conditional Formatting Based on a Range of Dates

The formula is =MATCH(this_date,date_range,0) where this_date is A10 (a relative reference to the top-left cell in the Applies To range), and date_range is $Y$9:$Y$300 (an absolute reference to the list of holidays in column Y).

The MATCH formula only returns TRUE if it finds this_date within date_range. (See VLOOKUP and INDEX-MATCH Examples to learn about lookup formulas).

How to Highlight Values NOT in a Range

In some spreadsheets, I use conditional formatting to highlight values that are NOT within another range. Along with Data Validation, this can help with error checking.

The formula for the rule is =ISERROR(MATCH(this_cell,other_range,0)). This returns TRUE when MATCH does not find this_cell within other_range.

I’ve used this technique in my original Money Management Template to verify budget categories.

How to Use Conditional Formatting to Create a Gantt Chart

Watch the new Video Series: How to Make a Gantt Chart in Excel!

Most of my Gantt Chart Templates use a combination of many conditional formatting rules. The example below (from the Simple Gantt Chart) demonstrates (1) how to create the bars that show the date range for each task and (2) how to show the current date using a red border.

How to Use Conditional Formatting to Create a Gantt Chart

Rule 1 uses the formula =AND(task_end>=G$5,task_start<G$5+1) where task_end is a relative named range defined as $D7 and task_start is a relative named range defined as $C7. Using named ranges isn’t necessary. The formula could be written as =AND($D7>=G$5,$C7<G$5+1)

Rule 2 can use the same formula, with today’s date in place of both task_end and task_start. Or, the rule could be as simple as =G$5=TODAY().

The proper use of absolute and relative ranges is absolutely critical here. So, pay special attention to the placement of the dollar signs.

Note You may notice that row 7 is hidden in the screenshot. The reason for hiding the first row of the gantt chart is so that if a person inserts a row above row 8, it will use the formatting from row 7 rather than the formatting from row 6.

Using a «No-Format Stop» Rule

In some of my Gantt charts, such as the Construction Schedule, the user can pick the color of each bar. Each different color requires a separate conditional formatting rule.

One way to do this would be to add the color condition to each rule like this: =AND($D7=»red»,task_end>=G$5,task_start<G$5+1).

However, I often prefer to use what I call a «No-Format Stop» Rule. Instead of saying where you want the color to be applied, this rule defines where the color should NOT be, and stops if true.

Using a No-Format Rule for Advanced Conditional Formatting Logic

This No-Format Stop rule can be as simple as adding NOT() around the main gantt chart rule like this =NOT(AND(task_end>=G$5,task_start<G$5+1)). It’s called a «No-Format» rule because no formatting is applied. Its only purpose is to prevent the rules that come after it from being applied.

The following rules then need to only check for what color to assign. In the example, the color is entered in column D. When cell D7 is blank, the bar will be gray. When D7=»B», the bar will be blue … and so on.

Use Data Bars to Compare Two Groups

Charts like the population example below are popular for comparing two different groups.

Data Bars for Comparing Male and Female Population

The trick to creating a chart like this with Data Bars is to use two different columns. The settings for the Male column use the «Right-to-Left» direction as shown in the image below.

Settings for Data Bar Comparisons

!!! The column widths and the Min/Max values need to be identical for both columns of data, or the visual display will misrepresent the numbers. In this case, the Minimum is 0 and the Maximum is 25 for both the blue data bars and the red data bars.

You could argue that this type of graph is not ideal for making exact comparisons between the Male and Female population. For example, if the numbers weren’t included in the chart, could you tell that for Age 40 to 49 there were more females (20.48 vs. 20.14)? No, you couldn’t. The bars look like they are the same length.

Our brains make better length comparisons when two things are aligned and parallel. The next chart uses Data Bars arranged a little differently. Now you CAN see the difference between the Male and Female population.

Data Bars for Comparing Male and Female Population - Better

Control Scaling by Linking Min/Max to Cells

A great solution for controlling the scaling for Data Bars and Color Scales is to link the Minimum and Maximum values to cells that you can edit. Using this approach, you can have different rules using the same Min/Max values. Here’s an example:

Animation - Data Bars Scale Linked to Cells

To do this, edit the rule settings with cell references like this:

Data Bars Minimum and Maximum Linked to Cells

The green data bar and blue data bars in this example are separate rules, but both rules use Min/Max values linked to cells C139 and D139.

Change Number Formats via Conditional Formatting

Some tricks I like to use in my templates involve changing the custom number format via conditional formatting based on user-selected options. If you aren’t already familiar with how to create custom number formats, I would encourage you to read the article Custom Number Formats in Excel.

Suffice it to say for now that you assign custom number formats by going to the Number tab when editing the Format for a conditional formatting rule.

Custom Number Formats via Conditional Formatting

Change Date Formats to d/m/yyyy

If you are sharing a file with people from different countries, you may want a simple way to switch the display of dates from m/d/y to d/m/y. I use this technique in Gantt Chart Template Pro.

Changing Date Formats using Conditional Formatting

The date in cell F131 displays a date as m/d/yyyy by default, but when the user selects «dmy» in cell D131, the CF rule changes the format to d/m/yyyy.

You could set up similar options to switch time formats between standard and 24-hour time, or change the display of numbers from decimal to fractions.

Note Developers: To avoid having to switch between date formats, use the built-in date formats marked with the asterisk (*) when you can. From Excel: «Date formats that begin with an asterisk (*) respond to changes in regional date and time settings that are specified for the operating system.»

Hide Zero Values

This example shows 3 different ways to hide zero values using conditional formatting.

How to Hide Zero Values using Conditional Formatting

  • The 2nd column hides the zero values by changing the font color to white.
  • The 3rd column changes the custom number format to » — «.
  • The 3rd column changes the custom number format to » «.

I personally prefer replacing zeros with a dash because otherwise the cell looks blank, and cells that look blank tend to be deleted or overwritten because you think they are empty.

Automatic Indenting

A custom number format will allow you to add text characters before or after the number, so you can simulate indenting by adding a number of spaces before your text using the format code » «@.

I use this technique in both the free Work Breakdown Structure template, and the premium Gantt Chart Template.

Automatic Indenting via Conditional Formatting

In this example, the formula is counting the number of decimal points in the WBS number. One rule adds 3 spaces before the text if it finds 1 decimal point. A second rule adds 6 spaces before the text if it finds 2 decimal points. See the article Text Manipulation Formulas to learn how this formula counts decimal places.

Display 23K, 23M, or 23B Based on the Value

Displaying large numbers as thousands, millions, or billions is VERY common, but how do you automatically display «K» or «M» or «B» depending on the value of the number? Using 3 different CF rules with the custom format codes 0.0K, 0.0M, and 0.0B.

Display Thousands, Millions, or Billions using CF Rules

Display Custom Icons

Excel has a limited number of icons available for Icon Sets. However, if you use unicode symbols and emojis, you can create your own icons using multiple CF rules. The format codes in this example are simply 0* X where X is the unicode character. To place the icon on the left with the number on the right, you could use X* 0.00 instead.

Custom Icons Using Emojis in CF Rules

Check out the Moon Phase Calendar to see how it uses conditional formatting to replace dates in a calendar with moon phase unicode characters.

Using Conditional Formatting to Display Moon Phases

How to Copy Conditional Formatting

The simple answer is that unless you tell Excel or Google Sheets NOT to, conditional formatting will be copied whenever other formatting is copied. For example, when you copy/paste cells, when you use the format painter tool, and when you insert rows and columns.

Copying conditional formatting may not always behave the way you expect it to. Sometimes that may not matter, but in other cases it may cause significant errors in how the data is interpreted. So, it’s always a good idea to check your conditional formatting rules after copying/pasting.

One of the main problems I’ve seen occurs when copying a row and inserting the copied row. Rules may be split, resulting in separate rules for different ranges when you expect there to be only one rule for the entire range. This can cause problems with color scales and data bars, especially.

To avoid the problem of splitting CF rules, when pasting you can use Paste Special and choose the «All Merging Conditional Formats» option.

Conditional Formatting is Volatile

If you use a lot of conditional formatting in your worksheet, or the rules involve inefficient formulas, you may notice Excel appear to slow down. That is because Conditional Formatting is volatile — meaning that the rules are evaluated every time the display refreshes.

To experiment with this concept, I built the following example. The fire in the display will flicker every time rules are evaluated, allowing you to test actions that cause the display to refresh.

Conditional Formatting is Volatile

Download the Example File (VolatileCF.xlsx)

Wrap Up and Final Tips

If you like this article, or use some of these ideas, please share the link to this article via your website and social media!

I didn’t talk about all the possible uses for conditional formatting, and not even some of the most common uses, such as making negative values red and highlighting based on specific text values. That is partly because many of these techniques are extremely easy to implement using the built-in options.

If you have questions, please go ahead and submit a comment below.

If you’d like to try some geeky fun, check out the Mine Blaster 1000 game. It makes use of multiple overlapping conditional formatting rules to create a game something roughly like Minesweeper (without any VBA).

Mine Blaster 1000 - Using Conditional Formatting

In this article we will learn how to color rows based on text criteria we use the “Conditional Formatting” option. This option is available in the “Home Tab” in the “Styles” group in Microsoft Excel.

Conditional Formatting in Excel is used to highlight the data on the basis of some criteria. It would be difficult to see various trends just for examining your Excel worksheet. Conditional Formatting in excel provides a way to visualize data and make worksheets easier to understand.

Excel Conditional Formatting allows you to apply formatting basis on the cell values such as colors, icons and data bars. For this, we will create a rule in  excel Conditional Formatting based on cell value

How to write an if statement in excel?
IF function is used for logic_test and returns value on the basis of the result of the logic_test. Excel conditional formatting formula multiple conditions uses Statements like less than or equal to or greater than or equal to the value are used in IF formula

Syntax:

=IF (logical_test, [value_if_true], [value_if_false])

Let’s learn how to do conditional formatting in excel using IF function with the example.

Here is a list of Names and their respective Scores.

IF 1

multiple if statements excel functions are used here. So, there are 3 results based on the condition. if then statements in excel is used via excel conditional formatting formula

Write the formula in C2 cell.
Formula

=IF(B2<50,»C»,IF(B2<75,»B»,»A»))

Explanation:
IF function only returns 2 results, one [value_if_True] and Second [value-if_False]
First IF function checks, if the score is less than 50, would get C grade, The Second IF function tests if the score is less than 75 would get B grade and the rest A grade.

IF 2

Copy the formula in other cells, select the cells taking the first cell where the formula is already applied, use shortcut key Ctrl + D

IF 3

Now we will apply conditional formatting to it.

Select Home >Conditional Formatting > New Rule.

IF 4

A dialog box appears

IF 5

Select Format only cells that contain > Specific text in option list and write C as text to be formatted.

Fill Format with Red colour and click OK.

Now select the colour Yellow and Green for A and B respectively as done above for C.

IF 6

In this article, we used IF function and Conditional formatting tool to get highlighted grade.

As you can see excel change cell color based on value of another cell using IF function and Conditional formatting tool

Hope you learned how to use conditional formatting in Excel using IF function. Explore more conditional formulas in excel here. You can perform Conditional Formatting in Excel 2016, 2013 and 2010. If you have any unresolved query regarding this article, please do mention below. We will help you.

Related Articles:

How to use the Conditional formatting based on another cell value in Excel

How to use the Conditional Formatting using VBA in Microsoft Excel

How to use the Highlight cells that contain specific text in Excel

How to Sum Multiple Columns with Condition in Excel

Popular Articles:

50 Excel Shortcut to Increase Your Productivity

How to use the VLOOKUP Function in Excel

How to use the COUNTIF function in Excel 2016

How to use the SUMIF Function in Excel

Понравилась статья? Поделить с друзьями:
  • If not command in excel
  • If mid function excel
  • If love was a word скачать
  • If love was a word перевод песни
  • If love was a word song