Excel if value colour row

Conditional formatting can help make patterns and trends in your data more apparent. To use it, you create rules that determine the format of cells based on their values, such as the following monthly temperature data with cell colors tied to cell values. 

Conditional formatting example

You can apply conditional formatting to a range of cells (either a selection or a named range), an Excel table, and in Excel for Windows, even a PivotTable report.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Conditional formatting typically works the same way in a range of cells, an Excel table, or a PivotTable report. However, conditional formatting in a PivotTable report has some extra considerations:

  • There are some conditional formats that don’t work with fields in the Values area of a PivotTable report. For example, you can’t format such fields based on whether they contain unique or duplicate values. These restrictions are mentioned in the remaining sections of this article, where applicable.

  • If you change the layout of the PivotTable report by filtering, hiding levels, collapsing and expanding levels, or moving a field, the conditional format is maintained as long as the fields in the underlying data are not removed.

  • The scope of the conditional format for fields in the Values area can be based on the data hierarchy and is determined by all the visible children (the next lower level in a hierarchy) of a parent (the next higher level in a hierarchy) on rows for one or more columns, or columns for one or more rows.

    Note: In the data hierarchy, children do not inherit conditional formatting from the parent, and the parent does not inherit conditional formatting from the children.

  • There are three methods for scoping the conditional format of fields in the Values area: by selection, by corresponding field, and by value field.

The default method of scoping fields in the Values area is by selection. You can change the scoping method to the corresponding field or value field by using the Apply formatting rule to option button, the New Formatting Rule dialog box, or the Edit Formatting Rule dialog box.

Method

Use this method if you want to select

Scoping by selection

  • A contiguous set of fields in the Values area, such as all of the product totals for one region.

  • A non-contiguous set of fields in the Values area, such as product totals for different regions across levels in the data hierarchy.

Scoping by value field

  • Avoid making many non-contiguous selections.

  • Conditionally format a set of fields in the Values area for all levels in the hierarchy of data.

  • Include subtotals and grand totals.

Scoping by corresponding field

  • Avoid making many non-contiguous selections.

  • Conditionally format a set of fields in the Values area for one level in the hierarchy of data.

  • Exclude subtotals.

When you conditionally format fields in the Values area for top, bottom, above average, or below average values, the rule is based on all visible values by default. However, when you scope by corresponding field, instead of using all visible values, you can apply the conditional format for each combination of:

  • A column and its parent row field.

  • A row and its parent column field.

Note: Quick Analysis is not available in Excel 2010 and previous versions.

Use the Quick Analysis button Quick Analysis button to apply selected conditional formatting to the selected data. The Quick Analysis button appears automatically when you select data.

  1. Select the data that you want to conditionally format. The Quick Analysis button appears on the lower-right corner of the selection.

    Selected data with the Quick Analysis button

  2. Click the Quick Analysis button Quick Analysis button, or press Ctrl+Q.

  3. In the pop-up that appears, on the Formatting tab, move your mouse over the different options to see a Live Preview on your data, and then click on the formatting option you want.

    Formatting tab in the Quick Analysis gallery

    Notes: 

    • The formatting options that appear in the Formatting tab depend on the data you have selected. If your selection contains only text, then the available options are Text, Duplicate, Unique, Equal To, and Clear. When the selection contains only numbers, or both text and numbers, then the options are Data Bars, Colors, Icon Sets, Greater, Top 10%, and Clear.

    • Live preview will only render for those formatting options that can be used on your data. For example, if your selected cells don’t contain matching data and you select Duplicate, the live preview will not work.

  4. If the Text that Contains dialog box appears, enter the formatting option you want to apply and click OK.

If you’d like to watch a video that shows how to use Quick Analysis to apply conditional formatting, see Video: Use conditional formatting.

You can download a sample workbook that contains different examples of applying conditional formatting, both with standard rules such as top and bottom, duplicates, Data Bars, Icon Sets and Color Scales, as well as manually creating rules of your own.

Download: Conditional formatting examples in Excel

Color scales are visual guides that help you understand data distribution and variation. A two-color scale helps you compare a range of cells by using a gradation of two colors. The shade of the color represents higher or lower values. For example, in a green and yellow color scale, as shown below, you can specify that higher value cells have a more green color and lower value cells have a more yellow color.

Tip: You can sort cells that have this format by their color — just use the context menu.

Formatting all cells with a two-color scale

Tip: If any cells in the selection contain a formula that returns an error, the conditional formatting is not applied to those cells. To ensure that the conditional formatting is applied to those cells, use an IS or IFERROR function to return a value other than an error value.

Quick formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Color Scales.

    Conditional Formatting

  3. Select a two-color scale.

    Hover over the color scale icons to see which icon is a two-color scale. The top color represents higher values, and the bottom color represents lower values.

You can change the method of scoping for fields in the Values area of a PivotTable report by using the Formatting Options button that appears next to a PivotTable field that has conditional formatting applied.

Advanced formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a completely new conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Apply Rule To, to optionally change the scope for fields in the Values area of a PivotTable report by:

    • Selection: Click Selected cells.

    • All cells for a Value label: Click All cells showing <Value label> values.

    • All cells for a Value label, excluding subtotals and the grand total: Click All cells showing <Value label> values for <Row Label>.

  5. Under Select a Rule Type, click Format all cells based on their values (default).

  6. Under Edit the Rule Description, in the Format Style list box, select 2-Color Scale.

  7. To select a type in the Type box for Minimum and Maximum, do one of the following:

    • Format lowest and highest values:    Select Lowest Value and Highest Value.

      In this case, you do not enter a Minimum and MaximumValue.

    • Format a number, date, or time value:    Select Number and then enter a Minimum and MaximumValue.

    • Format a percentage Percent:    Enter a Minimum and MaximumValue.

      Valid values are from 0 (zero) to 100. Don’t enter a percent sign.

      Use a percentage when you want to visualize all values proportionally because the distribution of values is proportional.

    • Format a percentile:    Select Percentile and then enter a Minimum and MaximumValue. Valid percentiles are from 0 (zero) to 100.

      Use a percentile when you want to visualize a group of high values (such as the top 20thpercentile) in one color grade proportion and low values (such as the bottom 20th percentile) in another color grade proportion, because they represent extreme values that might skew the visualization of your data.

    • Format a formula result:    Select Formula and then enter values for Minimum and Maximum.

      • The formula must return a number, date, or time value.

      • Start the formula with an equal sign (=).

      • Invalid formulas result in no formatting being applied.

      • It’s a good idea to test the formula to make sure that it doesn’t return an error value.

        Notes: 

        • Make sure that the Minimum value is less than the Maximum value.

        • You can choose a different type for the Minimum and Maximum. For example, you can choose a number for Minimum a percentage for Maximum.

  8. To choose a Minimum and Maximum color scale, click Color for each, and then select a color.

    If you want to choose additional colors or create a custom color, click More Colors. The color scale you select is shown in the Preview box.

Color scales are visual guides that help you understand data distribution and variation. A three-color scale helps you compare a range of cells by using a gradation of three colors. The shade of the color represents higher, middle, or lower values. For example, in a green, yellow, and red color scale, you can specify that higher value cells have a green color, middle value cells have a yellow color, and lower value cells have a red color.

Tip: You can sort cells that have this format by their color — just use the context menu.

Quick formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Color Scales.

    Conditional Formatting

  3. Select a three-color scale. The top color represents higher values, the center color represents middle values, and the bottom color represents lower values.

    Hover over the color scale icons to see which icon is a three-color scale.

You can change the method of scoping for fields in the Values area of a PivotTable report by using the Formatting Options button that appears next to a PivotTable field that has conditional formatting applied..

Advanced formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a new conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Apply Rule To, to optionally change the scope for fields in the Values area of a PivotTable report by:

    • Selection:    Click Just these cells.

    • Corresponding field:    Click All <value field> cells with the same fields.

    • Value field:    Click All <value field> cells.

  5. Under Select a Rule Type, click Format all cells based on their values.

  6. Under Edit the Rule Description, in the Format Style list box, select 3-Color Scale.

  7. Select a type for Minimum, Midpoint, and Maximum. Do one of the following:

    • Format lowest and highest values:    Select a Midpoint.

      In this case, you do not enter a Lowest and HighestValue.

    • Format a number, date, or time value:    Select Number and then enter a value for Minimum, Midpoint, and Maximum.

    • Format a percentage:    Select Percent and then enter a value for Minimum, Midpoint, and Maximum. Valid values are from 0 (zero) to 100. Do not enter a percent (%) sign.

      Use a percentage when you want to visualize all values proportionally, because using a percentage ensures that the distribution of values is proportional.

    • Format a percentile:    Select Percentile and then enter a value for Minimum, Midpoint, and Maximum.

      Valid percentiles are from 0 (zero) to 100.

      Use a percentile when you want to visualize a group of high values (such as the top 20th percentile) in one color grade proportion and low values (such as the bottom 20th percentile) in another color grade proportion, because they represent extreme values that might skew the visualization of your data.

    • Format a formula result:    Select Formula and then enter a value for Minimum, Midpoint, and Maximum.

      The formula must return a number, date, or time value. Start the formula with an equal sign (=). Invalid formulas result in no formatting being applied. It’s a good idea to test the formula to make sure that it doesn’t return an error value.

      Notes: 

      • You can set minimum, midpoint, and maximum values for the range of cells. Make sure that the value in Minimum is less than the value in Midpoint, which in turn is less than the value in Maximum.

      • You can choose a different type for Minimum, Midpoint, and Maximum. For example, you can choose a Minimum number, Midpoint percentile, and Maximum percent.

      • In many cases, the default Midpoint value of 50 percent works best, but you can adjust this to fit unique requirements.

  8. To choose a Minimum, Midpoint, and Maximum color scale, click Color for each, and then select a color.

    • To choose additional colors or create a custom color, click More Colors.

    • The color scale you select is shown in the Preview box.

A data bar helps you see the value of a cell relative to other cells. The length of the data bar represents the value in the cell. A longer bar represents a higher value, and a shorter bar represents a lower value. Data bars are useful in spotting higher and lower numbers, especially with large amounts of data, such as top selling and bottom selling toys in a holiday sales report.

The example shown here uses data bars to highlight dramatic positive and negative values. You can format data bars so that the data bar starts in the middle of the cell, and stretches to the left for negative values.

Data bars that highlight positive and negative values

Tip: If any cells in the range contain a formula that returns an error, the conditional formatting is not applied to those cells. To ensure that the conditional formatting is applied to those cells, use an IS or IFERROR function to return a value (such as 0 or «N/A») instead of an error value.

Quick formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Style group, click the arrow next to Conditional Formatting, click Data Bars, and then select a data bar icon.

    Conditional Formatting

You can change the method of scoping for fields in the Values area of a PivotTable report by using the Apply formatting rule to option button.

Advanced formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Apply Rule To, to optionally change the scope for fields in the Values area of a PivotTable report by:

    • Selection:    Click Just these cells.

    • Corresponding field:    Click All <value field> cells with the same fields.

    • Value field:    Click All <value field> cells.

  5. Under Select a Rule Type, click Format all cells based on their values.

  6. Under Edit the Rule Description, in the Format Style list box, select Data Bar.

  7. Select a Minimum and MaximumType. Do one of the following:

    • Format lowest and highest values:    Select Lowest Value and Highest Value.

      In this case, you do not enter a value for Minimum and Maximum.

    • Format a number, date, or time value:    Select Number and then enter a Minimum and MaximumValue.

    • Format a percentage:    Select Percent and then enter a value for Minimum and Maximum.

      Valid values are from 0 (zero) to 100. Do not enter a percent (%) sign.

      Use a percentage when you want to visualize all values proportionally, because using a percentage ensures that the distribution of values is proportional.

    • Format a percentile    Select Percentile and then enter a value for Minimum and Maximum.

      Valid percentiles are from 0 (zero) to 100.

      Use a percentile when you want to visualize a group of high values (such as the top 20th percentile) in one data bar proportion and low values (such as the bottom 20th percentile) in another data bar proportion, because they represent extreme values that might skew the visualization of your data.

    • Format a formula result     Select Formula, and then enter a value for Minimum and Maximum.

      • The formula has to return a number, date, or time value.

      • Start the formula with an equal sign (=).

      • Invalid formulas result in no formatting being applied.

      • It’s a good idea to test the formula to make sure that it doesn’t return an error value.

    Notes: 

    • Make sure that the Minimum value is less than the Maximum value.

    • You can choose a different type for Minimum and Maximum. For example, you can choose a Minimum number and a Maximum percent.

  8. To choose a Minimum and Maximum color scale, click Bar Color.

    If you want to choose additional colors or create a custom color, click More Colors. The bar color you select is shown in the Preview box.

  9. To show only the data bar and not the value in the cell, select Show Bar Only.

  10. To apply a solid border to data bars, select Solid Border in the Border list box and choose a color for the border.

  11. To choose between a solid bar and a gradiated bar, choose Solid Fill or Gradient Fill in the Fill list box.

  12. To format negative bars, click Negative Value and Axis and then, in the Negative Value and Axis Settings dialog box, choose options for the negative bar fill and border colors. You can choose position settings and a color for the axis. When you are finished selecting options, click OK.

  13. You can change the direction of bars by choosing a setting in the Bar Direction list box. This is set to Context by default, but you can choose between a left-to-right and a right-to-left direction, depending on how you want to present your data.

Use an icon set to annotate and classify data into three to five categories separated by a threshold value. Each icon represents a range of values. For example, in the 3 Arrows icon set, the green up arrow represents higher values, the yellow sideways arrow represents middle values, and the red down arrow represents lower values.

Tip: You can sort cells that have this format by their icon — just use the context menu.

The example shown here works with several examples of conditional formatting icon sets.

Different icon sets for the same data

You can choose to show icons only for cells that meet a condition; for example, displaying a warning icon for those cells that fall below a critical value and no icons for those that exceed it. To do this, you hide icons by selecting No Cell Icon from the icon drop-down list next to the icon when you are setting conditions. You can also create your own combination of icon sets; for example, a green «symbol» check mark, a yellow «traffic light», and a red «flag.»

Tip: If any cells in the selection contain a formula that returns an error, the conditional formatting is not applied to those cells. To ensure that the conditional formatting is applied to those cells, use an IS or IFERROR function to return a value (such as 0 or «N/A») instead of an error value.

Quick formatting

  1. Select the cells that you want to conditionally format.

  2. On the Home tab, in the Style group, click the arrow next to Conditional Formatting, click Icon Set, and then select an icon set.

    Conditional Formatting

You can change the method of scoping for fields in the Values area of a PivotTable report by using the Apply formatting rule to option button.

Advanced formatting

  1. Select the cells that you want to conditionally format.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Apply Rule To, to optionally change the scope for fields in the Values area of a PivotTable report by:

    • Selection:    Click Just these cells.

    • Corresponding field:    Click All <value field> cells with the same fields.

    • Value field:    Click All <value field> cells.

  5. Under Select a Rule Type, click Format all cells based on their values.

  6. Under Edit the Rule Description, in the Format Style list box, select Icon Set.

    1. Select an icon set. The default is 3 Traffic Lights (Unrimmed). The number of icons and the default comparison operators and threshold values for each icon can vary for each icon set.

    2. You can adjust the comparison operators and threshold values. The default range of values for each icon are equal in size, but you can adjust these to fit your unique requirements. Make sure that the thresholds are in a logical sequence of highest to lowest from top to bottom.

    3. Do one of the following:

      • Format a number, date, or time value:    Select Number.

      • Format a percentage:    Select Percent.

        Valid values are from 0 (zero) to 100. Do not enter a percent (%) sign.

        Use a percentage when you want to visualize all values proportionally, because using a percentage ensures that the distribution of values is proportional.

      • Format a percentile:    Select Percentile. Valid percentiles are from 0 (zero) to 100.

        Use a percentile when you want to visualize a group of high values (such as the top 20th percentile) using a particular icon and low values (such as the bottom 20th percentile) using another icon, because they represent extreme values that might skew the visualization of your data.

      • Format a formula result:    Select Formula, and then enter a formula in each Value box.

        • The formula must return a number, date, or time value.

        • Start the formula with an equal sign (=).

        • Invalid formulas result in no formatting being applied.

        • It’s a good idea to test the formula to make sure that it doesn’t return an error value.

    4. To make the first icon represent lower values and the last icon represent higher values, select Reverse Icon Order.

    5. To show only the icon and not the value in the cell, select Show Icon Only.

      Notes: 

      • You may need to adjust the column width to accommodate the icon.

      • The size of the icon shown depends on the font size that is used in that cell. As the size of the font is increased, the size of the icon increases proportionally.

To more easily find specific cells, you can format them by using a comparison operator. For example, in an inventory worksheet sorted by categories, you could highlight products with fewer than 10 items on hand in yellow. Or, in a retail store summary worksheet, you might identify all stores with profits greater than 10%, sales volumes less than $100,000, and region equal to «SouthEast.»

The examples shown here work with examples of built-in conditional formatting criteria, such as Greater Than, and Top %. This formats cities with a population greater than 2,000,000 with a green background and average high temperatures in the top 30% with orange.

Formatting shows cities with more than 2 million, and top 30% of high temperatures

Note: You cannot conditionally format fields in the Values area of a PivotTable report by text or by date, only by number.

Quick formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Style group, click the arrow next to Conditional Formatting, and then click Highlight Cells Rules.

    Conditional Formatting

  3. Select the command you want, such as Between, Equal To Text that Contains, or A Date Occurring.

  4. Enter the values you want to use, and then select a format.

You can change the method of scoping for fields in the Values area of a PivotTable report by using the Apply formatting rule to option button.

If you’d like to watch videos of these techniques, see Video: Conditionally format text and Video: Conditionally format dates.

Advanced formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet or on other worksheets, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Apply Rule To, to optionally change the scope for fields in the Values area of a PivotTable report by:

    • Selection:    Click Just these cells.

    • Corresponding field:    Click All <value field> cells with the same fields.

    • Value field:    Click All <value field> cells.

  5. Under Select a Rule Type, click Format only cells that contain.

  6. Under Edit the Rule Description, in the Format only cells with list box, do one of the following:

    • Format by number, date, or time:    Select Cell Value, select a comparison operator, and then enter a number, date, or time.

      For example, select Between and then enter 100 and 200, or select Equal to and then enter 1/1/2009.

      You can also enter a formula that returns a number, date, or time value.

      • If you enter a formula, start it with an equal sign (=).

      • Invalid formulas result in no formatting being applied.

      • It’s a good idea to test the formula to make sure that it doesn’t return an error value.

    • Format by text:    Select Specific Text, choosing a comparison operator, and then enter text.

      For example, select Contains and then enter Silver, or select Starting with and then enter Tri.

      Quotes are included in the search string, and you may use wildcard characters. The maximum length of a string is 255 characters.

      You can also enter a formula that returns text.

      • If you enter a formula, start it with an equal sign (=).

      • Invalid formulas result in no formatting being applied.

      • It’s a good idea to test the formula to make sure that it doesn’t return an error value.

      To see a video of this technique, see Video: Conditionally format text.

    • Format by date:    Select Dates Occurring and then select a date comparison.

      For example, select Yesterday or Next week.

      To see a video of this technique, see Video: Conditionally format dates.

    • Format cells with blanks or no blanks:    Select Blanks or No Blanks.

      A blank value is a cell that contains no data and is different from a cell that contains one or more spaces (spaces are considered as text).

    • Format cells with error or no error values:    Select Errors or No Errors.

      Error values include: #####, #VALUE!, #DIV/0!, #NAME?, #N/A, #REF!, #NUM!, and #NULL!.

  7. To specify a format, click Format. The Format Cells dialog box appears.

  8. Select the number, font, border, or fill format you want to apply when the cell value meets the condition, and then click OK.

    You can choose more than one format. The formats you select are shown in the Preview box.

You can find the highest and lowest values in a range of cells that are based on a cutoff value you specify. For example, you can find the top 5 selling products in a regional report, the bottom 15% products in a customer survey, or the top 25 salaries in a department .

Quick formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Style group, click the arrow next to Conditional Formatting, and then click Top/Bottom Rules.

    Conditional Formatting

  3. Select the command you want, such as Top 10 items or Bottom 10 %.

  4. Enter the values you want to use, and then select a format.

You can change the method of scoping for fields in the Values area of a PivotTable report by using the Apply formatting rule to option button.

Advanced formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Apply Rule To, to optionally change the scope fields in the Values area of a PivotTable report by:

    • Selection:    Click Just these cells.

    • Corresponding field:    Click All <value field> cells with the same fields.

    • Value field:    Click All <value field> cells.

  5. Under Select a Rule Type, click Format only top or bottom ranked values.

  6. Under Edit the Rule Description, in the Format values that rank in the list box, select Top or Bottom.

  7. Do one of the following:

    • To specify a top or bottom number, enter a number and then clear the % of the selected range box. Valid values are 1 to 1000.

    • To specify a top or bottom percentage, enter a number and then select the % of the selected range box. Valid values are 1 to 100.

  8. Optionally, change how the format is applied for fields in the Values area of a PivotTable report that are scoped by corresponding field.

    By default, the conditional format is based on all visible values. However when you scope by corresponding field, instead of using all visible values, you can apply the conditional format for each combination of:

    • A column and its parent row field, by selecting each Column group.

    • A row and its parent column field, by selecting each Row group.

  9. To specify a format, click Format. The Format Cells dialog box appears.

  10. Select the number, font, border, or fill format you want to apply when the cell value meets the condition, and then click OK.

    You can choose more than one format. The formats you select are shown in the Preview box.

You can find values above or below an average or standard deviation in a range of cells. For example, you can find the above average performers in an annual performance review or you can locate manufactured materials that fall below two standard deviations in a quality rating.

Quick formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Style group, click the arrow next to Conditional Formatting, and then click Top/Bottom Rules.

    Conditional Formatting

  3. Select the command you want, such as Above Average or Below Average.

  4. Enter the values you want to use, and then select a format.

You can change the method of scoping for fields in the Values area of a PivotTable report by using the Apply formatting rule to option button.

Advanced formatting

  1. Select one or more cells in a range, table, or PivotTable report.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Apply Rule To, to optionally change the scope for fields in the Values area of a PivotTable report by:

    • Selection:    Click Just these cells.

    • Corresponding field:    Click All <value field> cells with the same fields.

    • Value field:    Click All <value field> cells.

  5. Under Select a Rule Type, click Format only values that are above or below average.

  6. Under Edit the Rule Description, in the Format values that are list box, do one of the following:

    • To format cells that are above or below the average for all of the cells in the range, select Above or Below.

    • To format cells that are above or below one, two, or three standard deviations for all of the cells in the range, select a standard deviation.

  7. Optionally, change how the format is applied for fields in the Values area of a PivotTable report that are scoped by corresponding field.

    By default, the conditionally format is based on all visible values. However when you scope by corresponding field, instead of using all visible values, you can apply the conditional format for each combination of:

    • A column and its parent row field, by selecting each Column group.

    • A row and its parent column field, by selecting each Row group.

  8. Click Format to display the Format Cells dialog box.

  9. Select the number, font, border, or fill format you want to apply when the cell value meets the condition, and then click OK.

    You can choose more than one format. The formats you select are displayed in the Preview box.

Note: You can’t conditionally format fields in the Values area of a PivotTable report by unique or duplicate values.

In the example shown here, conditional formatting is used on the Instructor column to find instructors that are teaching more than one class (duplicate instructor names are highlighted in a pale red color). Grade values that are found just once in the Grade column (unique values) are highlighted in a green color.

Values in column C that aren't unique are colored rose, unique values in column D are green

Quick formatting

  1. Select the cells that you want to conditionally format.

  2. On the Home tab, in the Style group, click the arrow next to Conditional Formatting, and then click Highlight Cells Rules.

    Conditional Formatting

  3. Select Duplicate Values.

  4. Enter the values you want to use, and then select a format.

Advanced formatting

  1. Select the cells that you want to conditionally format.

  2. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules. The Conditional Formatting Rules Manager dialog box appears.

  3. Do one of the following:

    • To add a conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet or table is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet, and then by selecting Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  4. Under Select a Rule Type, click Format only unique or duplicate values.

  5. Under Edit the Rule Description, in the Format all list box, select unique or duplicate.

  6. Click Format to display the Format Cells dialog box.

  7. Select the number, font, border, or fill format you want to apply when the cell value meets the condition, and then click OK.

    You can choose more than one format. The formats you select are shown in the Preview box.

If none of the above options is what you’re looking for, you can create your own conditional formatting rule in a few simple steps. 

Notes: If there’s already a rule defined that you just want to work a bit differently, duplicate the rule and edit it.

  1. Select Home > Conditional Formatting > Manage Rules, then in the Conditional Formatting Rule Manager dialog, select a listed rule and then select Duplicate Rule. The duplicate rule then appears in the list.

  2. Select the duplicate rule, then select Edit Rule.

  1. Select the cells that you want to format.

  2. On the Home tab, click Conditional Formatting > New Rule.

    New formatting rule

  3. Create your rule and specify its format options, then click OK.

    If you don’t see the options that you want, you can use a formula to determine which cells to format — see the next section for steps).

If you don’t see the exact options you need when you create your own conditional formatting rule, you can use a logical formula to specify the formatting criteria. For example, you may want to compare values in a selection to a result returned by a function or evaluate data in cells outside the selected range, which can be in another worksheet in the same workbook. Your formula must return True or False (1 or 0), but you can use conditional logic to string together a set of corresponding conditional formats, such as different colors for each of a small set of text values (for example, product category names).

Note: You can enter cell references in a formula by selecting cells directly on a worksheet or other worksheets. Selecting cells on the worksheet inserts absolute cell references. If you want Excel to adjust the references for each cell in the selected range, use relative cell references. For more information, see Create or change a cell reference and Switch between relative, absolute, and mixed references.

Tip: If any cells contain a formula that returns an error, conditional formatting is not applied to those cells. To address this, use IS functions or an IFERROR function in your formula to return a value that you specify (such as 0, or «N/A») instead of an error value.

  1. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules.

    Conditional Formatting

    The Conditional Formatting Rules Manager dialog box appears.

  2. Do one of the following:

    • To add a conditional format, click New Rule. The New Formatting Rule dialog box appears.

    • To add a new conditional format based on one that is already listed, select the rule, then click Duplicate Rule. The duplicate rule is copied and appears in the dialog box. Select the duplicate, then select Edit Rule. The Edit Formatting Rule dialog box appears. 

    • To change a conditional format, do the following:

      1. Make sure that the appropriate worksheet, table, or PivotTable report is selected in the Show formatting rules for list box.

      2. Optionally, change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box, by selecting the new range of cells on the worksheet or other worksheets, and then by clicking Expand Dialog.

      3. Select the rule, and then click Edit rule. The Edit Formatting Rule dialog box appears.

  3. Under Apply Rule To, to optionally change the scope for fields in the Values area of a PivotTable report, do the following:

    • To scope by selection:    Click Selected cells.

    • To scope by corresponding field:    Click All cells showing <Values field> values.

    • To scope by Value field:    Click All cells showing <Values field> for <Row>.

  4. Under Select a Rule Type, click Use a formula to determine which cells to format.

    1. Under Edit the Rule Description, in the Format values where this formula is true list box, enter a formula.

      You have to start the formula with an equal sign (=), and the formula must return a logical value of TRUE (1) or FALSE (0).

    2. Click Format to display the Format Cells dialog box.

    3. Select the number, font, border, or fill format you want to apply when the cell value meets the condition, and then click OK.

      You can choose more than one format. The formats you select are shown in the Preview box.

      Example 1: Use two conditional formats with criteria that uses AND and OR tests    

      The following example shows the use of two conditional formatting rules. If the first rule doesn’t apply, the second rule applies.

      First rule: a home buyer has budgeted up to $75,000 as a down payment and $1,500 per month as a mortgage payment. If both the down payment and the monthly payments fit these requirements, cells B4 and B5 are formatted green.

      Second rule: if either the down payment or the monthly payment doesn’t meet the buyer’s budget, B4 and B5 are formatted red. Change some values, such as the APR, the loan term, the down payment, and the purchase amount to see what happens with the conditionally formatted cells.

      Formula for first rule (applies green color)

      =AND(IF($B$4<=75000,1),IF(ABS($B$5)<=1500,1))

      Formula for second rule (applies red color)

      =OR(IF($B$4>=75000,1),IF(ABS($B$5)>=1500,1))

      Cells B4 and B5 meet their conditions, so they're formatted green

      Example 2: Shade every other row by using the MOD and ROW functions    

      A conditional format applied to every cell in this worksheet shades every other row in the range of cells with a blue cell color. You can select all cells in a worksheet by clicking the square above row 1 and to the left of column A. The MOD function returns a remainder after a number (the first argument) is divided by divisor (the second argument). The ROW function returns the current row number. When you divide the current row number by 2, you always get either a 0 remainder for an even number or a 1 remainder for an odd number. Because 0 is FALSE and 1 is TRUE, every odd numbered row is formatted. The rule uses this formula: =MOD(ROW(),2)=1.

      Every other row is shaded blue

      Note: You can enter cell references in a formula by selecting cells directly on a worksheet or other worksheets. Selecting cells on the worksheet inserts absolute cell references. If you want Excel to adjust the references for each cell in the selected range, use relative cell references. For more information, see Create or change a cell reference and Switch between relative, absolute, and mixed references.

The following video shows you the basics of using formulas with conditional formatting.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

If you want to apply an existing formatting style to new or other data on your worksheet, you can use Format Painter to copy the conditional formatting to that data.

  1. Click the cell that has the conditional formatting that you want to copy.

  2. Click Home > Format Painter.

    Copy and Paste buttons on the Home tab

    The pointer changes to a paintbrush.

    Tip: You can double-click Format Painter if you want to keep using the paintbrush to paste the conditional formatting in other cells.

  3. To paste the conditional formatting, drag the paintbrush across the cells or ranges of cells you want to format.

  4. To stop using the paintbrush, press Esc.

Note: If you’ve used a formula in the rule that applies the conditional formatting, you might have to adjust any cell references in the formula after pasting the conditional format. For more information, see Switch between relative, absolute, and mixed references.

If your worksheet contains conditional formatting, you can quickly locate the cells so that you can copy, change, or delete the conditional formats. Use the Go To Special command to find only cells with a specific conditional format, or to find all cells that have conditional formats.

Find all cells that have a conditional format

  1. Click any cell that does not have a conditional format.

  2. On the Home tab, in the Editing group, click the arrow next to Find & Select, and then click Conditional Formatting.

    Editing group on the Home tab

Find only cells that have the same conditional format

  1. Click any cell that has the conditional format that you want to find.

  2. On the Home tab, in the Editing group, click the arrow next to Find & Select, and then click Go To Special.

  3. Click Conditional formats.

  4. Click Same under Data validation.

    Editing group on the Home tab

When you use conditional formatting, you set up rules that Excel uses to determine when to apply the conditional formatting. To manage these rules, you should understand the order in which these rules are evaluated, what happens when two or more rules conflict, how copying and pasting can affect rule evaluation, how to change the order in which rules are evaluated, and when to stop rule evaluation.

  • Learn about conditional formatting rule precedence

    You create, edit, delete, and view all conditional formatting rules in the workbook by using the Conditional Formatting Rules Manager dialog box. (On the Home tab, click Conditional Formatting, and then click Manage Rules.)

    Conditional Formatting menu with Manage Rules highlighted

    The Conditional Formatting Rules Manager dialog box appears.

    When two or more conditional formatting rules apply, these rules are evaluated in order of precedence (top to bottom) by how they are listed in this dialog box.

    Here’s an example that has expiration dates for ID badges. We want to mark badges that expire within 60 days but are not yet expired with a yellow background color, and expired badges with a red background color.

    Conditionally formatted data

    In this example, cells with employee ID numbers who have certification dates due to expire within 60 days are formatted in yellow, and ID numbers of employees with an expired certification are formatted in red. The rules are shown in the following image.

    Conditional formatting rules

    The first rule (which, if True, sets cell background color to red) tests a date value in column B against the current date (obtained by using the TODAY function in a formula). Assign the formula to the first data value in column B, which is B2. The formula for this rule is =B2<TODAY(). This formula tests the cells in column B (cells B2:B15). If the formula for any cell in column B evaluates to True, its corresponding cell in column A (for example, A5 corresponds to B5, A11 corresponds to B11), is then formatted with a red background color. After all the cells specified under Applies to are evaluated with this first rule, the second rule is tested. This formula checks if values in the B column are less than 60 days from the current date (for example, suppose today’s date is 8/11/2010). The cell in B4, 10/4/2010, is less than 60 days from today, so it evaluates as True, and is formatted with a yellow background color. The formula for this rule is =B2<TODAY()+60. Any cell that was first formatted red by the highest rule in the list is left alone.

    A rule higher in the list has greater precedence than a rule lower in the list. By default, new rules are always added to the top of the list and therefore have a higher precedence, so you’ll want to keep an eye on their order. You can change the order of precedence by using the Move Up and Move Down arrows in the dialog box.

    Move Up and Move Down arrows

  • What happens when more than one conditional formatting rule evaluates to True

    Sometimes you have more than one conditional formatting rule that evaluates to True. Here’s how rules are applied, first when rules don’t conflict, and then when they do conflict:

    When rules don’t conflict     For example, if one rule formats a cell with a bold font and another rule formats the same cell with a red color, the cell is formatted with both a bold font and a red color. Because there is no conflict between the two formats, both rules are applied.

    When rules conflict     For example, one rule sets a cell font color to red and another rule sets a cell font color to green. Because the two rules are in conflict, only one can apply. The rule that is applied is the one that is higher in precedence (higher in the list in the dialog box).

  • How pasting, filling, and the Format Painter affect conditional formatting rules

    While editing your worksheet, you may copy and paste cell values that have conditional formats, fill a range of cells with conditional formats, or use the Format Painter. These operations can affect conditional formatting rule precedence in the following way: a new conditional formatting rule based on the source cells is created for the destination cells.

    If you copy and paste cell values that have conditional formats to a worksheet opened in another instance of Excel (another Excel.exe process running at the same time on the computer), no conditional formatting rule is created in the other instance and the format is not copied to that instance.

  • What happens when a conditional format and a manual format conflict

    If a conditional formatting rule evaluates as True, it takes precedence over any existing manual format for the same selection. This means that if they conflict, the conditional formatting applies and the manual format does not. If you delete the conditional formatting rule, the manual formatting for the range of cells remains.

    Manual formatting is not listed in the Conditional Formatting Rules Manager dialog box nor is it used to determine precedence.

  • Controlling when rule evaluation stops by using the Stop If True check box

    For backwards compatibility with versions of Excel earlier than Excel 2007, you can select the Stop If True check box in the Manage Rules dialog box to simulate how conditional formatting might appear in those earlier versions of Excel that do not support more than three conditional formatting rules or multiple rules applied to the same range.

    For example, if you have more than three conditional formatting rules for a range of cells, and are working with a version of Excel earlier than Excel 2007, that version of Excel:

    • Evaluates only the first three rules.

    • Applies the first rule in precedence that is True.

    • Ignores rules lower in precedence if they are True.

    The following table summarizes each possible condition for the first three rules:

    If rule

    Is

    And if rule

    Is

    And if rule

    Is

    Then

    One

    True

    Two

    True or False

    Three

    True or False

    Rule one is applied and rules two and three are ignored.

    One

    False

    Two

    True

    Three

    True or False

    Rule two is applied and rule three is ignored.

    One

    False

    Two

    False

    Three

    True

    Rule three is applied.

    One

    False

    Two

    False

    Three

    False

    No rules are applied.

    You can select or clear the Stop If True check box to change the default behavior:

    • To evaluate only the first rule, select the Stop If True check box for the first rule.

    • To evaluate only the first and second rules, select the Stop If True check box for the second rule.

    You can’t select or clear the Stop If True check box if the rule formats by using a data bar, color scale, or icon set.

If you’d like to watch a video showing how to manage conditional formatting rules, see Video: Manage conditional formatting.

The order in which conditional formatting rules are evaluated — their precedence — also reflects their relative importance: the higher a rule is on the list of conditional formatting rules, the more important it is. This means that in cases where two conditional formatting rules conflict with each other, the rule that is higher on the list is applied and the rule that is lower on the list is not applied.

  1. On the Home tab, in the Styles group, click the arrow next to Conditional Formatting, and then click Manage Rules.

    Conditional Formatting menu with Manage Rules highlighted

    The Conditional Formatting Rules Manager dialog box appears.

    The conditional formatting rules for the current selection are displayed, including the rule type, the format, the range of cells the rule applies to, and the Stop If True setting.

    If you don’t see the rule that you want, in the Show formatting rules for list box, make sure that the right range of cells, worksheet, table, or PivotTable report is selected.

  2. Select a rule. Only one rule can be selected at a time.

  3. To move the selected rule up in precedence, click Move Up. To move the selected rule down in precedence, click Move Down.

    Move Up and Move Down arrows

  4. Optionally, to stop rule evaluation at a specific rule, select the Stop If True check box.

Clear conditional formatting on a worksheet    

  • On the Home tab, click Conditional Formatting > Clear Rules > Clear Rules from Entire Sheet.

Follow these steps if you have conditional formatting in a worksheet, and you need to remove it.

For an entire
worksheet

  • On the Home tab, click Conditional Formatting > Clear Rules > Clear Rules from Entire Sheet.

In a range of cells

  1. Select the cells that contain the conditional formatting.

  2. Click the Quick Analysis Lens button image button that appears to the bottom right of the selected data.

    Notes: 
    Quick Analysis Lens will not be visible if:

    • All of the cells in the selected range are empty, or

    • There is an entry only in the upper-left cell of the selected range, with all of the other cells in the range being empty.

  3. Click Clear Format.

    Clear option

Find and remove the same conditional formats throughout a worksheet

  1. Click on a cell that has the conditional format that you want to remove throughout the worksheet.

  2. On the Home tab, click the arrow next to Find & Select, and then click Go To Special.

  3. Click Conditional formats.

  4. Click Same under Data validation. to select all of the cells that contain the same conditional formatting rules.

  5. On the Home tab, click Conditional Formatting > Clear Rules > Clear Rules from Selected Cells.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Tip: The following sections use examples so you can follow along in Excel for the web. To start, download the Conditional Formatting Examples workbook and save it to OneDrive. Then, open OneDrive in a web browser and select the downloaded file.

  1. Select the cells you want to format, then select Home > Styles > Conditional Formatting > New Rule. You can also open the Conditional Formatting pane and create a new rule without first selecting a range of cells.

    New Rule step 1

  2. Verify or adjust the cells in Apply to range.

  3. Choose a Rule Type and adjust the options to meet your needs. 

  4. When finished, select Done and the rule will be applied to your range.

  1. Select a cell which has a conditional format you want to change. Or you can select Home > Styles > Conditional Formatting > Manage Rules to open the Conditional Formatting task pane and select an existing rule.

  2. The Conditional Formatting task pane displays any rules which apply to specific cells or ranges of cells.

    Image showing step 2 of editing a Conditional Formatting rule

  3. Hover over the rule and select Edit by clicking the pencil icon. This opens the task pane for rule editing. 

  4. Modify the rule settings and click Done to apply the changes.

The Conditional Formatting task pane provides everything you need for creating, editing, and deleting rules. Use Manage Rules to open the task pane and work with all the Conditional Formatting rules in a selection or a sheet.

  1. In an open workbook, select Home > Styles > Conditional Formatting > Manage Rules.

  2. The Conditional Formatting task pane opens and displays the rules, scoped to your current selection. 

Manage Rules in the task pane

From here, you can: 

  • Choose a different scope on the Manage Rules in menu — for example, choosing this sheet tells Excel to look for all rules on the current sheet.

  • Add a rule by selecting New Rule (the plus sign).

  • Delete all rules in scope by selecting Delete All Rules (the garbage can).

You can use a formula to determine how Excel evaluates and formats a cell.  Open the Conditional Formatting pane and select an existing rule or create a new rule.

In the Rule Type dropdown, select Formula.

Select Formula Rule

Enter the formula in the box. You can use any formula that returns a logical value of TRUE (1) or FALSE (0), but you can use AND and OR to combine a set of logical checks.

For example, =AND(B3=»Grain»,D3<500) is true for a cell in row 3 if both B3=»Grain» and D3<500 are true.

Formula rule type

You can clear conditional formatting in selected cells or the entire worksheet.

  • To clear conditional formatting in selected cells, select the cells in the worksheet. Then Select Home > Styles > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells.

  • To clear conditional formatting in the entire worksheet, select Home > Styles > Conditional Formatting > Clear Rules > Clear Rules from Entire Sheet.

  • To delete conditional formatting rules, select Home > Styles > Conditional Formatting >Manage Rules and use the delete (garbage can) on a specific rule or the Delete all rules button.

Color scales are visual guides which help you understand data distribution and variation. Excel offers both two-color scales and three-color scales. 

A two-color scale helps you compare a range of cells by using a gradation of two colors. The shade of the color represents higher or lower values. For example, in a green and yellow color scale, you can specify that higher value cells be more green and lower value cells have a more yellow.

Two color scale formatting

A three-color scale helps you compare a range of cells by using a gradation of three colors. The shade of the color represents higher, middle, or lower values. For example, in a green, yellow, and red color scale, you can specify that higher value cells have a green color, middle value cells have a yellow color, and lower value cells have a red color.

Three color scale formatting

Tip: You can sort cells that have one of these formats by their color — just use the context menu.

  1. Select the cells that you want to conditionally format using color scales.

  2. Click Home > Styles > Conditional Formatting > Color Scales and select a color scale.

A data bar helps you see the value of a cell relative to other cells. The length of the data bar represents the value in the cell. A longer bar represents a higher value, and a shorter bar represents a lower value. Data bars are useful in spotting higher and lower numbers, especially with large amounts of data, such as top selling and bottom selling toys in a holiday sales report.

Data bars

  1. Select the cells that you want to conditionally format.

  2. Select Home > Styles > Conditional Formatting > Data Bars and select a style. 

Use an icon set to annotate and classify data into three to five categories separated by a threshold value. Each icon represents a range of values. For example, in the 3 Arrows icon set, the green up arrow represents higher values, the yellow sideways arrow represents middle values, and the red down arrow represents lower values.

Icon set

  1. Select the cells that you want to conditionally format.

  2. Select Home > Styles > Conditional Formatting > Icon Sets and choose an icon set.

This option lets you highlight specific cell values within a range of cells based on their specific contents. This can be especially useful when working with data sorted using a different range.

For example, in an inventory worksheet sorted by categories, you could highlight the names of products where you have fewer than 10 items in stock so it’s easy to see which products need restocking without resorting the data. 

  1. Select the cells that you want to conditionally format.

  2. Select Home > Styles > Conditional Formatting > Highlight Cell Rules.

  3. Select the comparison, such as Between, Equal To, Text That Contains, or A Date Occurring.

You can highlight the highest and lowest values in a range of cells which are based on a specified cutoff value.

Some examples of this would include highlighting the top five selling products in a regional report, the bottom 15% products in a customer survey, or the top 25 salaries in a department.

  1. Select the cells that you want to conditionally format.

  2. Select Home > Styles > Conditional Formatting > Top/Bottom Rules.

  3. Select the command you want, such as Top 10 items or Bottom 10 %.

  4. Enter the values you want to use, and select a format (fill, text, or border color).

You can highlight values above or below an average or standard deviation in a range of cells.

For example, you can find the above-average performers in an annual performance review, or locate manufactured materials that fall below two standard deviations in a quality rating.

  1. Select the cells that you want to conditionally format.

  2. Select Home> Styles > Conditional Formatting > Top/Bottom Rules.

  3. Select the option you want, such as Above Average or Below Average.

  4. Enter the values you want to use, and select a format (fill, text, or border color).

  1. Select the cells that you want to conditionally format.

  2. Select Home > Styles > Conditional Formatting > Highlight Cell Rules > Duplicate Values.

  3. Enter the values you want to use, and select a format (fill, text, or border color).

If you want to apply an existing formatting style to other cells on your worksheet, use Format Painter to copy the conditional formatting to that data.

  1. Click the cell that has the conditional formatting you want to copy.

  2. Click Home > Format Painter.

    Copy and Paste buttons on the Home tab

    The pointer will change to a paintbrush.

    Tip: You can double-click Format Painter if you want to keep using the paintbrush to paste the conditional formatting in other cells.

  3. Drag the paintbrush across the cells or range of cells you want formatted.

  4. To stop using the paintbrush, press Esc.

Note: If you’ve used a formula in the rule that applies the conditional formatting, you might have to adjust relative and absolute references in the formula after pasting the conditional format. For more information, see Switch between relative, absolute, and mixed references.

Note: You can’t use conditional formatting on external references to another workbook.

Need more help?

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

See Also

Conditional formatting compatibility issues

Watch Video – Highlight Rows based on Cell Values in Excel

In case you prefer reading written instruction instead, below is the tutorial.

Conditional Formatting allows you to format a cell (or a range of cells) based on the value in it.

But sometimes, instead of just getting the cell highlighted, you may want to highlight the entire row (or column) based on the value in one cell.

To give you an example, below I have a dataset where I have highlighted all the rows where the name of the Sales Rep is Bob.

Highlight Rows Based on Cell Value - which is Bob

In this tutorial, I will show you how to highlight rows based on a cell value using conditional formatting using different criteria.

Click here to download the Example file and follow along.

Highlight Rows Based on a Text Criteria

Suppose you have a dataset as shown below and you want to highlight all the records where the Sales Rep name is Bob.

DataSet where you want to highlight rows where name is Bob

Here are the steps to do this:

  1. Select the entire dataset (A2:F17 in this example).
  2. Click the Home tab.Home Tab in the Excel Ribbon
  3. In the Styles group, click on Conditional Formatting.Click on Conditional Formatting
  4. Click on ‘New Rules’.Click on New Rule - Highlight Rows Based on a Cell Value in Excel (Conditional Formatting)
  5. In the ‘New Formatting Rule’ dialog box, click on ‘Use a formula to determine which cells to format’.Use Formula Option to Highlight Rows based on cell value
  6. In the formula field, enter the following formula: =$C2=”Bob”Specify the Formula to Highlight rows if it is True
  7. Click the ‘Format’ button.Click on the Format Button
  8. In the dialog box that opens, set the color in which you want the row to get highlighted.Color to Fill to highlight the rows
  9. Click OK.

This will highlight all the rows where the name of the Sales Rep is ‘Bob’.

All rows where name is Bob are highlighted

Click here to download the Example file and follow along.

How does it Work?

Conditional Formatting checks each cell for the condition we have specified, which is =$C2=”Bob”

So when it’s analyzing each cell in row A2, it will check whether the cell C2 has the name Bob or not. If it does, that cell gets highlighted, else it doesn’t.

Note that the trick here is to use a dollar sign ($) before the column alphabet ($C1). By doing this, we have locked the column to always be C. So even when cell A2 is being checked for the formula, it will check C2, and when A3 is checked for the condition, it will check C3.

This allows us to highlight the entire row by conditional formatting.

Related: Absolute, Relative, and Mixed references in Excel.

Highlight Rows Based on a Number Criteria

In the above example, we saw how to check for a name and highlight the entire row.

We can use the same method to also check for numeric values and highlight rows based on a condition.

Suppose I have the same data (as shown below), and I want to highlight all the rows where the quantity is more than 15.

DataSet where you want to highlight rows where name is Bob

Here are the steps to do this:

  1. Select the entire dataset (A2:F17 in this example).
  2. Click the Home tab.
  3. In the Styles group, click on Conditional Formatting.
  4. Click on ‘New Rules’.
  5. In the ‘New Formatting Rule’ dialog box, click on ‘Use a formula to determine which cells to format’.
  6. In the formula field, enter the following formula: =$D2>=15Formula to Highlight all Rows Based on a Number Criteria
  7. Click the ‘Format’ button. In the dialog box that opens, set the color in which you want the row to get highlighted.
  8. Click OK.

This will highlight all the rows where the quantity is more than or equal to 15.

Resulting Data when Highlighting rows based on number criteria

Similarly, we can also use this to have criteria for the date as well.

For example, if you want to highlight all the rows where the date is after 10 July 2018, you can use the below date formula:

=$A2>DATE(2018,7,10)

Highlight Rows Based on a Multiple Criteria (AND/OR)

You can also use multiple criteria to highlight rows using conditional formatting.

For example, if you want to highlight all the rows where the Sales Rep name is ‘Bob’ and the quantity is more than 10, you can do that using the following steps:

  1. Select the entire dataset (A2:F17 in this example).
  2. Click the Home tab.
  3. In the Styles group, click on Conditional Formatting.
  4. Click on ‘New Rules’.
  5. In the ‘New Formatting Rule’ dialog box, click on ‘Use a formula to determine which cells to format’.
  6. In the formula field, enter the following formula: =AND($C2=”Bob”,$D2>10)Formula to Use Mutliple conditions when highlighting rows in Excel
  7. Click the ‘Format’ button. In the dialog box that opens, set the color in which you want the row to get highlighted.
  8. Click OK.

In this example, only those rows get highlighted where both the conditions are met (this is done using the AND formula).

Result when rows are highlighted based on multiple conditions

Similarly, you can also use the OR condition. For example, if you want to highlight rows where either the sales rep is Bob or the quantity is more than 15, you can use the below formula:

=OR($C2="Bob",$D2>15)

Click here to download the Example file and follow along.

Highlight Rows in Different Color Based on Multiple Conditions

Sometimes, you may want to highlight rows in a color based on the condition.

For example, you may want to highlight all the rows where the quantity is more than 20 in green and where the quantity is more than 15 (but less than 20) in orange.

To do this, you need to create two conditional formatting rules and set the priority.

Here are the steps to do this:

  1. Select the entire dataset (A2:F17 in this example).
  2. Click the Home tab.
  3. In the Styles group, click on Conditional Formatting.
  4. Click on ‘New Rules’.
  5. In the ‘New Formatting Rule’ dialog box, click on ‘Use a formula to determine which cells to format’.
  6. In the formula field, enter the following formula: =$D2>15Formula to Highlight rows where value is more than 15
  7. Click the ‘Format’ button. In the dialog box that opens, set the color to Orange.
  8. Click OK.
  9. In the ‘Conditional Formatting Rules Manager’ dialog box, click on ‘New Rule’.Click on New Rule
  10. In the ‘New Formatting Rule’ dialog box, click on ‘Use a formula to determine which cells to format’.
  11. In the formula field, enter the following formula: =$D2>20Formula to Highlight rows where value is more than 20
  12. Click the ‘Format’ button. In the dialog box that opens, set the color to Green.
  13. Click OK.
  14. Click Apply (or OK).

The above steps would make all the rows with quantity more than 20 in green and those with more than 15 (but less than equal to 20 in orange).

Data where rows are highlighted in two colors

Understanding the Order of Rules:

When using multiple conditions, it important to make sure the order of the conditions is correct.

In the above example, the Green color condition is above the Orange color condition.

Order of Conditions when formatting rows

If it’s the other way round, all the rows would be colored in orange only.

Why?

Because a row where quantity is more than 20 (say 23) satisfies both our conditions (=$D2>15 and =$D2>20). And since Orange condition is at the top, it gets preference.

You can change the order of the conditions by using the Move Up/Down buttons.

Buttons to change the order of formatting

Click here to download the Example file and follow along.

Highlight Rows Where Any Cell is Blank

If you want to highlight all rows where any of the cells in it is blank, you need to check for each cell using conditional formatting.

Here are the steps to do this:

  1. Select the entire dataset (A2:F17 in this example).
  2. Click the Home tab.
  3. In the Styles group, click on Conditional Formatting.
  4. Click on ‘New Rules’.
  5. In the ‘New Formatting Rule’ dialog box, click on ‘Use a formula to determine which cells to format’.
  6. In the formula field, enter the following formula: =COUNTIF($A2:$F2,””)>0Using Countif to count blank rows
  7. Click the ‘Format’ button. In the dialog box that opens, set the color to Orange.
  8. Click OK.

The above formula counts the number of blank cells. If the result is more than 0, it means there are blank cells in that row.

If any of the cells are empty, it highlights the entire row.

Highlighting Blank rows - Resulting Data

Related: Read this tutorial if you only want to highlight the blank cells.

Highlight Rows Based on Drop Down Selection

In the examples covered so far, all the conditions were specified with the conditional formatting dialog box.

In this part of the tutorial, I will show you how to make it dynamic (so that you can enter the condition within a cell in Excel and it will automatically highlight the rows based on it).

Below is an example, where I select a name from the drop-down, and all the rows with that name get highlighted:

Highlight Entire Row Based on Drop Down Selection

Here are the steps to create this:

  1. Create a drop-down list in cell A2. Here I have used the names of the sales rep to create the drop down list. Here is a detailed guide on how to create a drop-down list in Excel.
  2. Select the entire dataset (C2:H17 in this example).
  3. Click the Home tab.
  4. In the Styles group, click on Conditional Formatting.
  5. Click on ‘New Rules’.
  6. In the ‘New Formatting Rule’ dialog box, click on ‘Use a formula to determine which cells to format’.
  7. In the formula field, enter the following formula: =$E2=$A$2Rule to Highlight Cells that match the drop down value
  8. Click the ‘Format’ button. In the dialog box that opens, set the color to Orange.
  9. Click OK.

Now when you select any name from the drop-down, it will automatically highlight the rows where the name is the same that you have selected from the drop-down.

Interested in learning more on how to search and highlight in Excel? Check the below videos.

You May Also Like the Following Excel Tutorials:

  • Dynamic Excel Filter – Extracts Data as you Type.
  • Create a drop-down list with a search suggestion.
  • How to Insert and Use a Checkbox in Excel.
  • Select Visible Cells in Excel.
  • Highlight Active Row/Column in a Data Range.
  • Delete rows based on cell value in Excel
  • How to Delete Every Other Row in Excel
  • Apply Conditional Formatting Based on Another Column in Excel

Let’s say that one of our tasks is to entering of the information about: did the ordering to a customer in the current month. Then on the basis of the information you need to select the cell in color according to the condition: which from customers have not made any orders for the past 3 months. For these customers you will need to re-send the offer.

Of course it’s the task for Excel. The program should automatically find such counterparties and, accordingly, to color ones. For these conditions we will use to the conditional formatting.



The filling cells with dates automatically

At first, you need to prepare to the structure for filling the register. First of all, let’s consider to the ready example of the automated register, which is depicted in the picture below. Today date 07.07.2018:

Today.

The user to need only to specify, if the customer have made an order in the current month, in the corresponding cell you should enter the text value of «order». The main condition for the allocation: if for 3 months the contractor did not make any order, his number is automatically highlighted in red.

Presented this decision should automate some work processes and to simplify to the visual data analysis.

The automatic filling of the cells with the relevant dates

At first, for the register with numbers of customers we will create to the column headers with green and up to date for months that will automatically display to the periods of time. To do this, in the cell B1 you need to enter the following formula:

DATE.

How does the formula work for automatically generating of the outgoing months?

In the picture, the formula returns the period of time passing since the date of writing this article: 17.09.2017. In the first argument in the function DATE is the nested formula that always returns the current year to today’s date thanks to the functions: YEAR and TODAY. In the second argument is the month number (-1). The negative number means that we are interested in what it was a month last time. The example of the conditions for the second argument with the value:

  • 1 means the first month (January) in the year that is specified in the first argument;
  • 0 – it is 1 month ago;
  • -1 – there is 2 months ago from the beginning of the current year (i.e. 01.10.2016).

The last argument-is the day number of the month, which is specified in the second argument. As a result, the DATE function collects all parameters into a single value and the formula returns to the corresponding date.

Next, go to the cell C1 and type the following formula:

MONTH.

As you can see now the DATE function uses the value from the cell B1 and increases to the month number by 1 in relation to the previous cell. As the result is the 1 – the number of the following month.

Now you need to copy this formula from the cell C1 in the rest of the column headings in the range D1:AY1.

To highlight to the cell range B1:AY1 and select to the tool: «HOME»-«Cells»-«Format Cells» or just to press CTRL+1. In the dialog box that appears, in the tab «Number» in the section «Category» you need to select the option «Custom». In the «Type:» to enter the value: MMM. YY (required the letters in upper register). Because of this, we will get to the cropped display of the date values in the headers of the register, what simplifies to the visual analysis and make it more comfortable due to better readability.

Format Cells.

Please note! At the onset of the month of January (D1), the formula automatically changes in the date to the year in the next one.



How to select the column by color in Excel under the terms

Now you need to highlight to the cell by color which respect of the current month. Because of this, we can easily find the column in which you need to enter the actual data for this month. To do this:

  1. To select the range of the cells B2:AY15 and select the tool: «HOME» -«Styles» -«Conditional Formatting»-«New Rule». And in the appeared window «New Formatting Rule» you need to select the option: «Use a formula to determine which cells to format»
  2. Conditional Formatting.

  3. In the input field to enter the formula:
  4. input field.

  5. Click «Format» and indicate on the tab «Fill» in what color (for example green) will be the selected cells of the current month. Then on all Windows for confirmation to click «OK».

Format.

The column under the appropriate heading of the register is automatically highlighted in green accordingly to our terms and conditions:

register is automatically.

How does the formula highlight of the column color on a condition work?

Due to the fact that before the creation of the conditional formatting rule we have covered all the table data for inputting data of register, the formatting will be active for each cell in the range B2:AY15. The mixed reference in the formula B$1 (absolute address only for rows, but for columns it is relative) determines that the formula will always to refer to the first row of each column.

Automatic highlighting of the column in the condition of the current month

The main condition for the fill by color of the cells: if the range B1:AY1 is the same date that the first day of the current month, then the cells in a column change its colors by specified in conditional formatting.

Please note! In this formula, for the last argument of the function DATE is shown 1, in the same way as for formulas in determining the dates for the column headings of the register.

In our case, is the green filling of the cells. If we open our register in next month, that it has the corresponding column is highlighted in green regardless of the current day.

The table is formatted, now we are filling it with the text value of the «order» in a mixed order of clients for current and past months.

How to highlight the cells in red color according to the condition

Now we need to highlight in red to the cells with the numbers of clients who for 3 months have not made any order. To do this:

  1. Select the range of the cells A2:A15 (that is, the list of the customer numbers) and select to the tool: «HOME»-«Styles»-«Conditional formatting»-«Create rule». And in the window that appeared «Create a formatting rule» to select the option: «Use the formula for determining which cells to format».
  2. This time in the input box to enter the formula:
  3. COUNTIF.

  4. To click «Format» and specify the red color on the tab «Fill». Then on all Windows click «OK».
  5. Fill the cells with the text value of «order» as in the picture and look at the result:

result.

The numbers of customers are highlighted in red, if in the row has no have the value «order» in the last three cells for the current month (inclusively).

The analysis of the formula for the highlighting of cells according to the condition

Firstly, we will do by the middle part of our formula. The SHIFT function returns a range reference shifted relative to the basic range of the certain number of rows and columns. The returned reference can be a single cell or a range of cells. Optionally, you can define to the number of returned rows and columns. In our example, the function returns the reference to the cell range for the last 3 months.

The important part for our terms of highlighting in color – is belong to the first argument of the SHIFT function. It determines from which month to start the offset. In this example, there is the cell D2, that is, the beginning of the year – January. Of course for the rest of the cells in the column the row number for the base of the cell will correspond to the line number in what it is located. The following 2 arguments of the SHIFT function to determine how many rows and columns should be done offset. Since the calculations for each customer will carry in the same line, the offset value for the rows we specified is -0.

At the same time for the calculating the value of the third argument (the offset by the columns) we use to the nested formula MONTH(TODAY()), which in accordance with the terms returns to the number of the current month in the current year. From the calculated formula of the month as a number subtract the number 4, that is, in cases November we get the offset by 8 columns. And, for example, for June – there are on 2 columns only.

The last two arguments for the SHIFT function, determine the height (in the number of rows) and width (in the number of columns) of the returned range. In our example, there is the area of the cell with height on 1 row and with width on 4 columns. This range covers to the columns of 3 previous months and the current month.

The first function in the COUNTIF formula checks the condition: how many times in the returned range using the SHIFT function, we can found to the text value «order». If the function returns the value of 0, it means from the client with this number for 3 months there was not any order. And in accordance with our terms and conditions, the cell with number of this client is shown in red fill color.

If we want to register to data for customers, Excel is ideally suited for this purpose. You can easily record in the appropriate categories to the number of ordered goods, as well as the date of implementation of transaction. The problem gradually starts with arising of the data growth.

Download example automatic highlight cells by color.

If so many of them that we need to spend a few minutes looking for a specific position of the register and analysis of the information entered. In this case, it is necessary to add in the table to the register of mechanisms to automate some workflows of the user. And so we did.

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

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

Bottom Line: Learn to change the formatting of an entire row of data based on the value of one of the cells found in that row.

Skill Level: Intermediate

Video Tutorial

Watch on YouTube & Subscribe to our Channel

Download the Excel File

If you’d like to download the same file that I use in the video so you can see how it works firsthand, here it is:

Format an Entire Row Based on a Cell Value

Sometimes our spreadsheets can be overwhelming to our readers.  Especially when you have a large sheet of data with a lot of rows and columns.  The reader needs to see all the data, but we also want to draw attention to some rows based on a condition.

In this week’s post, I answer a question from Dawna, a member of one of our training programs.  She wanted to highlight the entire rows in a data set when the value in a cell in the row matched a value in a cell outside the table.

Conditional formatting applied to entire rows

For this scenario, we can use Conditional Formatting.  This is a great feature of Excel that brings life to our spreadsheets and makes them much easier to read.  

Conditional formatting also makes your files dynamic and interactive.  The user can quickly change the cell that contains the criteria and the matching rows will be highlighted. 

Dynamic changes to table based on cell value

In the image above I changed the value in cell E3 to 6. All rows that contain a 6 in column E are immediately formatted with the font & fill color I specified in the conditional formatting rule.

Conditional formatting is a fun feature that your boss and co-workers will love. Let’s get it set up!

Setting Up the Conditional Formatting

The video above walks through these steps in more detail:

  1. Start by deciding which column contains the data you want to be the basis of the conditional formatting. In my example, that would be the Month column (Column E).
  2. Select the cell in the first row for that column in the table. In my case, that would be E6.
  3. On the Home tab of the Ribbon, select the Conditional Formatting drop-down and click on Manage Rules…. That will bring up the Conditional Formatting Rules Manager window.
  4. Click on New Rule. This will open the New Formatting Rule window.
  5. Under Select a Rule Type, choose Use a formula to determine which cells to format.
  6. Under Format values where this formula is true, you are going to write a very simple formula. The formula should set the cell that you want the conditional formatting applied from equal to the first cell in the column that you already identified in Step 1. So in our example the formula would read =$E$3=$E$6.
  7. To ensure that the conditional formatting applies to all of the rows in the table, we need to change the absolute relative referencing. In other words, we are going to remove that dollar sign in front of the 6 in our formula. You can either manually delete it, or you can hit F4 twice to accomplish this step.
  8. Click on the Format… button to choose whatever format options you like. You can change the font, the fill, the border, etc.

Your New Formatting Rule window should look something like this:

New Formatting Rule Window

Once you hit OK, you will be taken back to the Conditional Formatting Rules Manager window. Here you will see the rule that you just created.

Conditional Formatting Rules Manager Window

You can click on Apply, but at this point the rule will only be applied to cell E6 because that is the cell you started from and it is what’s listed in the Applies to field. We want to extend this rule to the whole table.

To do that, click on the icon to the right of that field (it has an upward facing arrow) and select the range of the entire table. In the example, this would be the data ranging from B6 to G1002 (=$B$6:$G$1002).

Conditional Formatting Rules Manager Window Entire Data Set

Click Apply one more time and the new formatting applies to the entire data set.

New formatting applied to the data set

Using Other Comparison Operators

The rule that you create doesn’t always have to set a value equal to (=) another value. You can change the format for rows that are

  • less than (<),
  • less than or equal to (<=),
  • greater than (>),
  • greater than or equal to (>=),
  • or not equal to (<>)

any specific value. And it doesn’t have to be a number. It can be text, dates, or other data types as well.

It doesn’t matter which of those comparison operators you use. The conditional formatting is just applied based on whether your logic statements are true or false.

If you’d like to get a better understanding of logic statements, as well as IF functions, I recommend this tutorial:

IF Function Explained: How to Write an IF Statement Formula in Excel

The sample file also uses a drop-down list (data validation list) in cell E3. Check out my article on How to Create Drop-down Lists in Cells – Data Validation Lists to learn more.

Conclusion

I hope this is helpful to you. If you have any questions about the process, please leave them in the comments. You can also leave any suggestions or recommendations you might have on the topic.

Thank you!

Conditional Formatting generally checks the value in one cell and applies formatting over the other cells. A great application of conditional formatting is highlighting the entire row or multiple rows based on a cell value and condition provided in the formula.

 It is very helpful because for a data set with tons of value in it becomes cumbersome to analyze just by reading the data. So, if we highlight a few rows based on some conditions, it becomes easier for the user to infer from the data set. For example, in a college, some students have been blacklisted due to some illegal activities. So, in the Excel record the administrator can highlight the rows where these students records are present.

In this article we are going to see how to highlight row(s) based on cell value(s) using a suitable real time example shown below :

Example : Consider a company’s employees data is present. The following table consists of data about the project(s) which has been assigned to employees, their ages and ID. An employee can work on multiple projects. The blank cell in project denotes that no project has been assigned to that employee.

Highlighting the Rows

1. On the basis of text match : 

Aim : Highlight all the rows where Employee name is “Srishti”.

Steps :

1. Select the entire dataset from A3 to D14 in our case.

2. In the Home Tab select Conditional Formatting. A drop-down menu opens.

3. Select New Rule from the drop-down. The dialog box opens.

4. In the New Formatting Rule dialog box select “Use a Formula to determine which cells to format” in the Select a Rule Type option.

5. In the formula box, write the formula :

=$B2="Srishti"

$ is used to lock the column B, so that only the cell B is looked starting from Row 2

The formula will initially check if the name “Srishti” is present or not in the cell B2. Now, since cell B is locked and next time checking will be done from cell B3 and so on until the condition gets matched.

6. In the Preview field, select Format and then go to Fill and then select an appropriate color for highlighting and click OK

7. Now click OK and the rows will be highlighted.

Highlighted Rows

2. Non-text matching based on number :

Aim : Highlight all the rows having age less than 25.

Approach :

Repeat the above steps as discussed and in the formula write :

=$C3<25

Highlighted Rows

3. On the basis of OR/AND condition :

OR, AND are used when we have multiple conditions. These are logical operators which work on True value.

AND : If all conditions are TRUE, AND returns TRUE.

OR : At least one of the conditions needs to be TRUE to return TRUE value.

Aim :  Highlight all the rows of employees who are either working on Project 1 or Project 4.

The project details are in column D. So, the formula will be :

=OR($D3="P-1",$D3="P-4")

Aim : Suppose employee Rishabh has completed the project P-3. The administrator is asked to highlight the row and keep a record of projects which are finished.

The name is in column B and the project details is in column D. The formula will be :

=AND($B3="Rishabh",$D3="P-3")

Highlighted Row

4. On the basis of any blank row :

Aim : Check if there is/are any blank row(s). If exist(s), then highlight it.

The project details is in column D. We will use the COUNTIF( ) function to check for the number of blank records. The formula will be :

=COUNTIF($A3:$D3,"")>0

"" : Denotes blank

The above formula checks all the columns one by one and sees if there is at least one blank row. If the formula value is greater than zero then highlighting will be done else COUNTIF will return FALSE value and no highlighting will be done.

5. On the basis of multiple conditions and each condition having different color :

Aim : Suppose the company wants to distinguish the employees based on their ages. The employees whose age is more than 25 are senior employees and whose age is more than 20 but less than or equal to 25 are junior developers or trainees. So, the administrator is asked to highlight these two categories with different colors.

Implementation :

In the Formula Field write the formula :

=$C3>25

This will highlight all the rows where age is more than 25.

Again in the Formula Field write the formula :

=$C3>20

This will highlight all the rows greater than 20. It will in fact change the color of the rows where age is greater than 25. Since, if a number is greater than 20 then definitely it is greater than 25. So, all the cells having age more than 20 will be highlighted to the same color. 

This creates a problem as our goal is to make two separate groups. In order to resolve this we need to change the priority of highlighting the rows. The steps are :

  • Undo the previous steps using CTRL+Z.
  • Select the entire dataset.
  • Go to Conditional Formatting followed by Manage Rules.

  • In the Manage Rule dialog box :

The order of the condition needs to be changed. The condition at the top will have more priority than the lower one. So, we need to move the second condition to the top of the first one using the up icon after selecting the condition.

  • Now click on Apply and then OK. 

It can be observed that the rows are now divided into two categories : The yellow color is for the senior level employees and the green color is for junior employees and trainees in the company on the basis of their ages.

This tutorial will demonstrate how to highlight cells depending on the answer returned by an IF statement formula using Conditional Formatting in Excel and Google Sheets.

conditional formatting if statement master

Highlight Cells With Conditional Formatting

A cell can be formatted by conditional formatting based on the value returned by an IF statement on your Excel worksheet.

  1. First, create the IF statement in Column E.
    =IF(D4>C4,”Overdue”,”Ontime”)

conditional formatting if statement formula

  1. This formula can be copied down to Row 12.
  2. Now, create a custom formula within the Conditional Formatting rule to set the background color of all the “Overdue” cells to red.
  3. Select the range you want to apply formatting to.
  4. In the Ribbon, select Home > Conditional Formatting > New Rule.

conditional formatting if statement menu

  1. Select Use a formula to determine which cells to format, and enter the formula:
    =E4=”OverDue”

conditional formatting if statement formatting rule

  1. Click on the Format button and select your desired formatting.

conditional formating if statement set format

  1. Click OK, and then OK once again to return to the Conditional Formatting Rules Manager.

conditional formatting if statement rules manager

  1. Click Apply to apply the formatting to your selected range and then click Close.
    The formula entered will return TRUE when the cell contains the word “Overdue” and will therefore format the text in those cells with a background color of red.
  2. To format the “OnTime” cells to green, you can create another rule based on the same range of cells.

conditional formatting if statement rules manager second rule

  1. Click Apply to apply to the range.

conditional formatting if statement master final

Highlight Cells If… in Google Sheets

The process to highlight cells that contain an IF Statement in Google Sheets is similar to the process in Excel.

  1. Highlight the cells you wish to format, and then click on Format > Conditional Formatting.

google sheets conditional formatting if statement menu

  1. The Apply to Range section will already be filled in.

google sheets conditional formatting if statement range

  1. From the Format Rules section, select Custom Formula and type in the formula.

conditional formatting if statement custom formula

  1. Select the fill style for the cells that meet the criteria.

google sheets conditional formatting format

  1. Click Done to apply the rule.

google sheets conditional formatting if statement mastser final

Like this post? Please share to your friends:
  • Excel if true text
  • Excel if true add 1
  • Excel if this number is between
  • Excel if this is true and this is true
  • Excel if this is greater than that of