Excel formulas for conditional formatting based on another cell value

In this tutorial, we will continue exploring the fascinating world of Excel Conditional Formatting. If you do not feel very comfortable in this area, you may want to look through the previous article first to revive the basics - How to use conditional formatting in Excel 2010 and 2013.

Today are going to dwell on how to use Excel formulas to format individual cells and entire rows based on the values you specify or based on another cell's value. This is often considered advanced aerobatics of Excel conditional formatting and once mastered, it will help you push the formats in your spreadsheets far beyond their common uses.

Excel formulas for conditional formatting based on cell value

Excel's pre-defined conditional formatting rules are mainly purposed to format cells based on their own values or the values you specify. I am talking about Data Bars, Color Scales, Icon Sets and other rules available to you on the Conditional Formatting button click.

If you want to apply conditional formatting based on another cell or format the entire row based on a single cell's value, then you will need to use Excel formulas. So, let's see how you can make a rule using a formula and after that I will provide a number of formula examples for different tasks.

How to create a conditional formatting rule using a formula

As you remember, in all modern versions of Excel 2013, Excel 2010 and Excel2007, the conditional formatting feature resides on the Home tab > Styles group. In Excel 2003, you can find it under the Format menu.

So, you set up a conditional formatting rule based on a formula in this way:

  1. Select the cells you want to format. You can select one column, several columns or the entire table if you want to apply your conditional format to rows.

    Tip. If you plan to add more data in the future and you want the conditional formatting rule to get applied to new entries automatically, you can either:

    • Convert a range of cells to a table (Insert tab > Table). In this case, the conditional formatting will be automatically applied to all new rows.
    • Select some empty rows below your data, say 100 blank rows.
  2. Click Conditional formatting > New Rule…
    Creating a new conditional formatting rule using a formula
  3. In the New Formatting Rule window, select Use a formula to determine which cells to format.
  4. Enter the formula in the corresponding box.
  5. Click the Format… button to choose your custom format.
    Enter the formula and click the Format… button to choose your custom format.
  6. Switch between the Font, Border and Fill tabs and play with different options such as font style, pattern color and fill effects to set up the format that works best for you. If the standard palette does not suffice, click More colors… and choose any RGB or HSL color to your liking. When done, click the OK button.
    Switch between the Font, Border and Fill tab and set up your custom format.
  7. Make sure the Preview section displays the format you want and if it does, click the OK button to save the rule. If you are not quite happy with the format preview, click the Format… button again and make the edits.
    Make sure the Preview section displays the format you want and save the rule.

Excel conditional formatting formula examples

Now that you know how to create and apply Excel conditional formatting based on another cell, let's move on and see how to use various Excel formulas in practice:

Tip. For your Excel conditional formatting formula to work correctly, please always follow these simple rules.

Formulas to compare values (numbers and text)

As you know Microsoft Excel provides a handful of ready-to-use rules to format cells with values greater than, less than or equal to the value you specify (Conditional Formatting >Highlight Cells Rules). However, these rules do not work if you want to conditionally format certain columns or entire rows based on a cell's value in another column. In this case, you use analogous formulas:

Condition Formula example
Equal to =$B2=10
Not equal to =$B2<>10
Greater than =$B2>10
Greater than or equal to =$B2>=10
Less than =$B2<10
Less than or equal to =$B2<=10
Between =AND($B2>5, $B2<10)

The screenshot below shows an example of the Greater than formula that highlights product names in column A if the number of items in stock (column C) is greater than 0. Please pay attention that the formula applies to column A only ($A$2:$A$8). But if you select the whole table (in our case, $A$2:$E$8), this will highlight entire rows based on the value in column C.
Excel conditional formatting rule to highlight cells based on another cell's value.

In a similar fashion, you can create a conditional formatting rule to compare values of two cells. For example:

=$A2<$B2 - format cells or rows if a value in column A is less than the corresponding value in column B.

=$A2=$B2 - format cells or rows if values in columns A and B are the same.

=$A2<>$B2 - format cells or rows if a value in column A is not the same as in column B.

As you can see in the screenshot below, these formulas work for text values as well as for numbers.
Excel formulas to compare cells with text values

AND and OR formulas

If you want to format your Excel table based on 2 or more conditions, then use either =AND or =OR function:

Condition Formula Description
If both conditions are met =AND($B2<$C2, $C2<$D2) Formats cells if the value in column B is less than in column C, and if the value in column C is less than in column D.
If one of the conditions is met =OR($B2<$C2, $C2<$D2) Formats cells if the value in column B is less than in column C, or if the value in column C is less than in column D.

In the screenshot below, we use the formula =AND($C2>0, $D2="Worldwide") to change the background color of rows if the number of items in stock (Column C) is greater than 0 and if the product ships worldwide (Column D). Please pay attention that the formula works with text values as well as with numbers.
Excel conditional formatting rule with the =AND formula.

Naturally, you can use two, three or more conditions in your =AND and =OR formulas.

These are the basic conditional formatting formulas you use in Excel. Now let's consider a bit more complex but far more interesting examples.

Conditional formatting for empty and non-empty cells

I think everyone knows how to format empty and not empty cells in Excel - you simply create a new rule of the "Format only cells that contain" type and choose either Blanks or No Blanks.
A rule to format blank and non-blank cells in Excel

But what if you want to format cells in a certain column if a corresponding cell in another column is empty or not empty? In this case, you will need to utilize Excel formulas again:

Formula for blanks: =$B2="" - format selected cells / rows if a corresponding cell in Column B is blank.

Formula for non-blanks: =$B2<>"" - format selected cells / rows if a corresponding cell in Column B is not blank.

Note. The formulas above will work for cells that are "visually" empty or not empty. If you use some Excel function that returns an empty string, e.g. =if(false,"OK", ""), and you don't want such cells to be treated as blanks, use the following formulas instead =isblank(A1)=true or =isblank(A1)=false to format blank and non-blank cells, respectively.

And here is an example of how you can use the above formulas in practice. Suppose, you have a column (B) which is "Date of Sale" and another column (C) "Delivery". These 2 columns have a value only if a sale has been made and the item delivered. So, you want the entire row to turn orange when you've made a sale; and when an item is delivered, a corresponding row should turn green. To achieve this, you need to create 2 conditional formatting rules with the following formulas:

  • Orange rows (a cell in column B is not empty): =$B2<>""
  • Green rows (cells in column B and column C are not empty): =AND($B2<>"", $C2<>"")

One more thing for you to do is to move the second rule to the top and select the Stop if true check box next to this rule:
Conditional formatting rules to highlight rows based on other cells being blank or not blank

In this particular case, the "Stop if true" option is actually superfluous, and the rule will work with or without it. You may want to check this box just as an extra precaution, in case you add a few other rules in the future that may conflict with any of the existing ones.

Excel formulas to work with text values

If you want to apply conditional formatting to selected columns when another cell in the same row contains a certain word, you can use a simple formula like =$D2="Worldwide" (we've used a similar formula in one of the previous examples). However, this formula will work for exact match only.

For partial match, you will need another Excel function: =SEARCH. You use it in this way:

=SEARCH("Worldwide", $D2)>0 - format selected cells or rows if a corresponding cell in column D contains the word "Worldwide". This formula will find all such cells, regardless of where the search text is located in a cell, e.g. "Ships Worldwide", "Worldwide, except for…" etc.

=SEARCH("Worldwide", $D2)>1 - shade selected cells or rows if the cell's content starts with the search text.
Excel formulas to conditionally format cells based on text values

Excel formulas to highlight duplicates

If your task is to conditionally format cells with duplicate values, you can go with the pre-defined rule available under Conditional formatting > Highlight Cells Rules > Duplicate Values… The following article provides a detailed guidance on how to use this feature: How to automatically highlight duplicates in Excel.

However, in some cases the data looks better if you color selected columns or entire rows when a duplicate values occurs in another column. In this case, you will need to employ an Excel conditional formatting formula again, and this time we will be using the =COUNTIF formula. As you know, this Excel function counts the number of cells within a specified range that meet a single criterion.

Highlight duplicates including 1st occurrences

=COUNTIF($A$2:$A$10,$A2)>1 - this formula finds duplicate values in the specified range in Column A (A2:A10 in our case), including first occurrences.

If you choose to apply the rule to the entire table, the whole rows will get formatted, as you see in the screenshot below. I've decided to change a font color in this rule, just for a change : )
Excel formula to highlight duplicates including 1st occurrences

Highlight duplicates without 1st occurrences

To ignore the first occurrence and highlight only subsequent duplicate values, use this formula: =COUNTIF($A$2:$A2,$A2)>1
Excel formula to highlight duplicates without 1st occurrences

Highlight consecutive duplicates in Excel

If you'd rather highlight only duplicates on consecutive rows, you can do this in the following way. This method works for any data types: numbers, text values and dates.

  • Select the column where you want to highlight duplicates, without the column header.
  • Create a conditional formatting rule(s) using these simple formulas:
    Rule 1 (blue): =$A1=$A2 - highlights the 2nd occurrence and all subsequent occurrences, if any.
    Rule 2 (green): =$A2=$A3 - highlights the 1st occurrence.

In the above formulas, A is the column you want to check for dupes, $A1 - the column header, $A2 - the first cell with data.

Important! For the formulas to work correctly, it is essential that Rule 1, which highlights the 2nd and all subsequent duplicate occurrences, should be the first rule in the list, especially if you are using two different colors.
Highlighting consecutive duplicates in Excel

Check for duplicates across multiple columns

If you want apply the conditional format when duplicate values occur in two or more columns, you will need to add an extra column to your table in which you concatenate the values from the key columns using a simple formula like this one =A2&B2. After that you apply a rule using either variation of the =COUNTIF function (with or without 1st occurrences). Naturally, you can hide an additional column after creating the rule.
Excel formula to check for duplicates across several columns

Compare 2 columns for duplicates

One of the most frequent tasks in Excel is to check 2 columns for duplicate values - i.e. find and highlight values that exist in both columns. To do this, you will need to create an Excel conditional formatting rule for each column with a combination of =ISERROR() and =MATCH() functions:

For Column A: =ISERROR(MATCH(A1,$B$1:$B$10000,0))=FALSE

For Column B: =ISERROR(MATCH(B1,$A$1:$A$10000,0))=FALSE

Note. For such conditional formulas to work correctly, it's very important that you apply the rules to the entire columns, e.g. =$A:$A and =$B:$B.

You can see an example of practical usage in the following screenshot that highlights duplicates in Columns E and F.
Excel conditional formatting formulas to check 2 columns for duplicates

As you can see, Excel conditional formatting formulas cope with dupes pretty well. However, for more complex cases, I would recommend using the Duplicate Remover add-in that is especially designed to find, highlight and remove duplicates in Excel 2013, 2010, 2007 and 2003, in one sheet or between two spreadsheets.

Formulas to highlight values above or below average

When you work with several sets of numeric data, the =AVERAGE function may come in handy to format cells whose values are below or above the average in a column.

For example, you can use the formula =$E2<AVERAGE($E$2:$E$8) to conditionally format the rows where the sale numbers are below the average, as shown in the screenshot below. If you are looking for the opposite, i.e. to shade the products performing above the average, replace "<" with ">" in the formula: =$E2>AVERAGE($E$2:$E$8).
A conditional formatting rule to highlight values below average

How to highlight the nearest value in Excel

If I have a set of numbers, is there a way I can use Excel conditional formatting to highlight the number in that set that is closest to zero? This is what one of our blog readers, Jessica, wanted to know. The question is very clear and straightforward, but the answer is a bit too long for the comments sections, that's why you see a solution here :)

Example 1. Find the nearest value, including exact match

In our example, we'll find and highlight the number that is closest to zero. If the data set contains one or more zeroes, all of them will be highlighted. If there is no 0, then the value closest to it, either positive or negative, will be highlighted.

First off, you need to enter the following formula to any empty cell in your worksheet, you will be able to hide that cell later, if needed. The formula finds the number in a given range that is closest to the number you specify and returns the absolute value of that number (absolute value is the number without its sign):


In the above formula, B2:D13 is your range of cells and 0 is the number for which you want to find the closest match. For example, if you are looking for a value closest to 5, the formula will change to: =MIN(ABS(B2:D13-(5)))

Note. This is an array formula, so you need to press Ctrl + Shift + Enter instead of a simple Enter stroke to complete it.

And now, you create a conditional formatting rule with the following formula, where B3 is the top-right cell in your range and $C$2 in the cell with the above array formula:


Please pay attention to the use of absolute references in the address of the cell containing the array formula ($C$2), because this cell is constant. Also, you need to replace 0 with the number for which you want to highlight the closest match. For example, if we wanted to highlight the value nearest to 5, the formula would change to: =OR(B3=5-$C$2,B3=5+$C$2)

Highlight the closest value to a given number, including that number

Example 2. Highlight a value closest to the given value, but NOT exact match

In case you do not want to highlight the exact match, you need a different array formula that will find the closest value but ignore the exact match.

For example, the following array formula finds the value closest to 0 in the specified range, but ignores zeroes, if any:


Please remember to press Ctrl + Shift + Enter after you finished typing your array formula.

The conditional formatting formula is the same as in the above example:


However, since our array formula in cell C2 ignores the exact match, the conditional formatting rule ignores zeroes too and highlights the value 0.003 that is the closest match.
Highlight a value closest to the given value but ignore the exact match

If you want to find the value nearest to some other number in your Excel sheet, just replace "0" with the number you want both in the array and conditional formatting formulas.

I hope the conditional formatting formulas you have learned in this tutorial will help you make sense of whatever project you are working on. If you need more examples, please check out the following articles:

Why isn't my Excel conditional formatting working correctly?

If your conditional formatting rule is not working as expected, though the formula is apparently correct, do not get upset! Most likely it is not because of some weird bug in Excel conditional formatting, rather due to a tiny mistake, not evident at the first sight. Please try out 6 simple troubleshooting steps below and I'm sure you will get your formula to work:

  1. Use absolute & relative cell addresses correctly. It's very difficult to deduce a general rule that will work in 100 per cent of cases. But most often you would use an absolute column (with $) and relative row (without $) in your cell references, e.g. =$A1>1.

    Please keep in mind that the formulas =A1=1, =$A$1=1 and =A$1=1 will produce different results. If you are not sure which one is correct in your case, you can try all : ) For more information, please see Relative and absolute cell references in Excel conditional formatting.

  2. Verify the applied range. Check whether your conditional formatting rule applies to the correct range of cells. A rule of thumb is this - select all the cells / rows you want to format but do not include column headers.
  3. Write the formula for the top-left cell. In conditional formatting rules, cell references are relative to the top-left most cell in the applied range. So, always write your conditional formatting formula for the 1st row with data.

    For example, if your data starts in row 2, you put =A$2=10 to highlight cells with values equal to 10 in all the rows. A common mistake is to always use a reference to the first row (e.g. =A$1=10). Please remember, you reference row 1 in the formula only if your table does not have headers and your data really starts in row 1. The most obvious indication of this case is when the rule is working, but formats values not in the rows it should.

  4. Check the rule you created. Double-check the rule in the Conditional Formatting Rules Manager. Sometimes, for no reason at all, Microsoft Excel distorts the rule you have just created. So, if the rule is not working, go to Conditional Formatting > Manage Rules and check both the formula and the range it applies to. If you have copied the formula from the web or some other external source, make sure the straight quotes are used.
  5. Adjust cell references when copying the rule. If you copy Excel conditional formatting using Format Painter, don't forget to adjust all cell references in the formula.
  6. Split complex formulas into simple elements. If you use a complex Excel formula that includes several different functions, split it into simple elements and verify each function individually.

And finally, if you've tried all the steps but your conditional formatting rule is still not working correctly, drop me a line in comments and we will try to fathom it out together :)

In my next article we are going to look into the capabilities of Excel conditional formatting for dates. See you next week and thanks for reading!

Want to find more inventive tips, tricks and tutorials?

Please follow us on Google+:

568 Responses to "Excel formulas for conditional formatting based on another cell value"

  1. Jelena says:

    Hi! I have a bit particular case. I have to find duplicates (max 5) in column A worksheet_1 and copy only one of each duplicate in column A worksheet_2. Then I have to copy values from B worksheet_1 that correspond to each duplicate in B1:F1 of worksheet_2.

    For example:
    worksheet_1 worksheet_2
    A B A B C D E F
    1 kl5f 1 k15f ozpp
    2 l9j8 2 l9j8 kol
    6 yu60
    2 kol
    1 ozpp

    Thank you in avance

    • Jelena says:

      Normally the exemple was suppposed to be with spaces...

      • Hi Jelena!

        It's a bit difficult to understand what exactly result you are trying to achieve without seeing your data. If you can send me (support@ablebits.com) your sample workbook and the result you are looking for, I will try to help.

        • Anonymous says:

          what i m trying to do is that, if i enter value in single cell of a row the clour of that row or the selected cells should be changed by entering the data in the cell

          • If you want to color the entire row based on the data in a certain column, then select all the rows and columns with your data and create a rule using this formula:


            Where C is your column, 2 is the first row with data.

            If you want to highlight a row when at least one column contains data, use this formula:

            Where A and G are correspondingly the first and the last columns you want to check.

    • debashis says:

      i have a work sheet, many column,in a column many date are 14/15/16/17 if 15> then total row move to another sheet automatic

      • In this case Excel formulas cannot help, this task can be fulfilled using a macro.

      • hitesh says:

        Can you please give an answer of conditional formatting which is compared above for two columns where in countif formula has been used. Can you please brief. Because that scenarion is exactly with my question but in that i found one querry which is -

        Products are mentioned in column a and sales vales are mentioned in the other column. The conditional formatting which is used in that is not exactly giving the actual reaults.

        Because i hv seen and practically applied..

        Product1 2
        Product2 4
        Product3 6
        Product4 3
        Product1 2

        Here if product is matching and if the aale value that is matching then it should highlight both with the help of cnditional formatting however its still highlighting incase product one is mentioned two times and sale value ia differerent. So in that case it shiuld not highlight but its highlighting.
        Plz assist to resolve this scenario.
        Thanks in advance...

        • Hi Hitesh,

          There are two ways to fulfill your task: using a helper Column or our Duplicate Remover add-in.

          If you choose the former, do the following:
          - Add a helper column to your table, e.g. column C, and enter the following formula in cell C2:

          Where A and B are the columns you want to compare, 2 is the first row with the data.

          - Select columns A and B and create a conditional formatting rule using this formula:

          If you use the Duplicate Remover, you won't need to create a helper column and mess around with formulas. Just pick the "Fill with color" option on the final step of Duplicate Remover Wizard.

        • hitesh says:

          Hi Svetlana,
          Thanku so much. Its really awsome. My question has been reaolved. But there is a small thing which i wanted to add in.
          The scenarion which i discussed below related to conditional formatting by using countif formula.

          But the first product no. And sales value is not highlighting except that its highlighting from the below duplicate.ex-
          Below is tge scenario resolved with sugesstions provided by you. But firat plan is highlighting with by using countif formula and the next plan no. Which is 12345 and the same amount i.e.:-200 is highlighting

          Plan no. Name amount column d
          12345 a 200 =concatenate
          135937 b 300
          847474 C 400
          92828 d 500
          12345 a 200
          95850 e 600
          12345 a 100

          Please assist and advise if i can through these duplicate plans in another or sheet 2 without help of macro...

          Thanks in advance....

  2. Derek says:

    Hi! was wondering if you can help me with something on the similar subject.

    Column A + Column B = $F$5

    A Basic example is Column A has 2.70, 5.40, 8.10 Column B has 10.80, 21.60, 32.40 if I put 13.50 in the box I'd like the 2.70 in Column A and 10.80 to be highlighted in Column B etc.

    I've tried different ways like =A3+B$3=$F$5 and/or =B3+A$3=$F$5 but nothing seems to work can you help me.?


    • Hi Derek,

      You were almost there : ) You need to create a separate rule for column A and column B with this formula: =$A3+$B3=$F$5 Please note, it will work for Column A + Column B = $F$5, only if values in columns A and B are in the same row.

      If you want to highlight values in different rows that make a sum, you will need a bit more complex formulas:
      For Column A: =ISERROR(MATCH(ROUND($F$5-$A1,10),$B$1:$B$10,0))=FALSE
      For Column B: =ISERROR(MATCH(ROUND($F$5-$B1,10),$A$1:$A$10,0))=FALSE

      • Derek says:

        Wow that's a lot more complex than I thought it would be lol
        Ok last question I promise if I wanted to add one more column later what would I input?
        Thanks so much for your help I couldn't have worked that out for myself

        • Hi Derek,

          I'm glad to know the formulas have worked for you : )
          If you are asking about the 2nd case (sum in different rows), regrettably it's not possible to do in 3 columns (i.e. A + B + C = $F$5) using conditional formatting formulas, at least I do not know any way. This would require 2 nested loops, which can be done as a macro only.

  3. Naveen says:

    Hi, i want to format a cell based value of different cell. Please let me know how to do it.

    Ex: If value in Cell E2="Yes" the F2 cell needs to be in date format.

  4. RJT says:

    I am having an issue with using conditional formatting on my excel project. I want to highlight each number in a row that is different from each other in one single conditional formatting formula. How would I do that?

    • If my understanding is correct, you need to highlight unique values in each row. If so, the following formula will work a treat, where A is the first column and H is the last column with values:

  5. Sarah Heidel says:

    I am trying to find a formula to highlight the entire row based on the conditional formatting of one column.

    I formatted column 1 to highlight duplicates, and I want excel to highlight the entire row if there is a duplicate.

    Is this possible?

    • Hello Sarah,

      Of course, this is possible. You just need to extend the range for the formula to get applied to the entire table rather than 1 column. Simply open the Conditional Fromatting Rules Manager and change the range in the "Applies to" box.

      As an example, please see "Check for duplicates across multiple columns" in this article. As you see in the screenshot, the formula applies to the range A2:C9, and as a result the entire rows are highlighted based on cell value in column C.

  6. PH says:

    My conundrum is this:

    Cell I13 has zero formulas nested and only represents whatever number i type into it. I need the text or fill in cell I13 to be green if it's value is greater than or equal to the value in cell I14 and I need the color to be red if its value is less than the value represented in cell I14. I14 has a nested formula which represents a numerical value from cell D4. I have tried the Conditional Formating rules to no avail; is this algorithm even possible?

    • Hello PH,

      I've just tried creating 2 rules for cell I13 with the following formulas, and they worked just fine:

      Red: =$I$13<$I$14
      Green: =$I$13>=$I$14

      My cell I14 has a simple formula =D4, though in theory this should not make any difference. If the above formulas do not work for you, please specify which exactly formula you have in I14 so that I can test on the same data.

      • andrew says:

        similar to the question above, i want a conditional formula that i can apply to multiple cells in a range. if a cell contains a number > the number in the cell above, i want green; if the cell contains a number < the number in the cell above, i want red. i would like to drag this condition all the way down the column. is this possible?

  7. Rutger says:


    This already looks like an oracle now. I have an other challenge with duplicates. I have a file with different sheets. In Sheet D there is a cell that fills automaticly with information from the other sheets. I use this to generate Meta data for my website which I can import.

    Some of the data in Sheet D are duplicate. I like to make a rule which will change the data in this sheet/cell automaticly if the outcom of the formula used in Sheet D , Cell A is a duplicatie with a cell above in the same column.

    I hope you can help me with this info.



    • Hi Rutger,

      Try creating a rule with this simple formula =A2=A1 where A2 is the top-left most cell in the range where you want to color the duplicates and A1 is a cell above. This rule will color the second duplicate occurrence. If you need to highlight the first one as well, create one more rule with this formula =A2=A3.

      This solution works fine for one and several columns, except for the case if you have data in row 1. Hopefully this is not the case and you have column headers there : )

      • John says:

        Hi Svetlana,
        First what an amazing blog, I only occasionally use excel I had no idea it could do so much!!
        My problem is that when I use the formula =D3=C3 to highlight duplicates (where the first cell of data is c3) it highlights the first occurrence of the duplicate, not the second. I don't need the first highlighting but I do need the second. I don't know what I am doing wrong.
        Please help and keep up being the excel fairy!

        • Hi John,

          Thank you so much for your kind words.

          The formula I suggested for Rutger, is purposed for highlighting duplicates in the same column. As far as I understand, your formula is comparing cells in columns D and C, in the same rows. So, if you want to highlight only duplicate values in column D, the formula will work, just make sure the rule applies solely to this column.

          If you are looking for something different, please provide a bit more details.

          • John says:

            Hi Svetlana,
            Thanks for the response. Yes it does highlight the duplicates but it highlights the first example not the last. I don't want the first highlighting. So I need to know if a value has been repeated on the same row. So imagine 3b, 3a, 3a, 4c on a row of data I would only want the 2nd 3a highlighting not the first one. Using the formula you gave it highlights just the first ie: 3b, 3a, 3a, 4c. I don’t want this.
            Also I need it to highlight multiple duplicates and non consecutive duplicates. I need it to 2b, 2b, 2b, 2a . I also need it to do 2b, 2a, 2b, 3c,. So in all the examples I need only the second repeat to be highlighted. Hope you can help.

            • Hi John,

              Got it, please try this one:

              Where 3 is the first row and column A is the left-most column with data. The rule shall be applied to all columns (not including the header row), though only the left-most column is included in the formula.

  8. Kathleen says:


    I am wondering if there is a way to apply icons to words and not just numbers.

    For example the icons are in column B and I would like the "green check" icon to display when column J reads "YES".

    Is that possible?

    • Hi Kathleen,

      You can do this with the help of this formula =IF(J2="YES",1,""). Copy the formula all across column B, starting from cell B2.

      Then create an icon set rule and set a green flag for values >=1. Remember, to select the option "Show icon only".

  9. mk says:

    I have columns with dates in them. Each row is a different activity and the columns represent different schedule versions. If column C has one date and then a different date in column D, I want column to highlight in a color depending on if it occurs before or after the date in column C. I want to carry this down across several rows, but for some reason the conditional formatting is based only on the first row of data. How can I get the conditional formatting to apply to each individual row?

  10. Jen says:

    Hi! I'm having a problem figuring out how to get conditional formatting to work in the following scenario.

    I have a 3 column table. A and B will either have "Yes" or "No" as values. If both A and B = Yes, I want to highlight that row green. If both A and B = No, I want to highlight that row red. And if A and B have differing values from each other (e.g. A=No, B=Yes), I want to highlight that row yellow.

    I'm pretty sure I need to have 3 different rules, but other than that, I'm not sure where to start. I feel like this must be easier than I'm making it but I'm not sure how absolute and relative cell references work, and I think maybe that's part of my problem. Any help you can provide would be greatly appreciated! Thanks so much!

    • Hi Jen,

      Right, you will need 3 rules with the following formulas:

      Green: =AND($A2="Yes", $B2="Yes")
      Red: =AND($A2="No", $B2="No")
      Yellow: =$A2<>$B2 (in plain English, the <> operator means "not equal to")

      As for the cell references, I will try to explain in more detail:

      - Absolute cell references (with the $ sign) always remain constant, no matter where they are copied. Because you always compare values in columns A and B, you should use an absolute column reference. As you can see, a dollar sign ($) is used before all column letters in the above formulas.

      - Relative cells references (without the $ sign) change based on the relative position of rows and columns, when copied across multiple cells. Since you need to compare values in each row individually, you use relative row references in the formulas.

      In conditional formatting rules, cell references are relative to the top-left most cell in the applied range. So, you can simply pretend as if you are writing a formula for the top-left cell only, A2 in our case.

      Absolute and relative references in conditional formatting formulas behave in the same way as in usual Excel formulas (as described above). So, because you use relative row references, your formulas will "get changed" for each row and will compare the values in columns A and B in each individual row. I hope this makes sense :)

      • Jen says:


        Thank you so much for explaining the absolute and relative cell references. I looked it up more after I posted my question, but you've explained it better than anything else I've found!

        As for the conditional formatting formulas -- I had the red and green rules correct, except for the mixed references; the yellow formual I did not have correct and I'm not sure why I failed to find such an easy solution. The not equal to operator makes perfect sense.

        Thanks so much!

  11. Steve says:

    How do I test for the value of a cell color? I have a spread sheet where my customer combined rows of the same kind with a cell color. They did this manually. However I need to export this to a publishing program so is there a search for this? In the past, before the customer used color fill, I tested the data (=IF(F319=F320,"","{RULE}") and then I was able to place a rule below each group. Now with the cells filled with color, I'm at a loss.


  12. Bethany says:

    I am trying to do some Dynamic highlighting bas on a data validation list. My issue is when I create my conditional formatting formula =$J45=$E$40, the dynamic is only work for 1 value. When I switch values in the dropdown, the formula no longer works for the table range. Why is this?

    • Hello Bethany,

      It's very difficult to say what the problem may be without seeing your data. Your formula works for column J only since you use an absolute column reference. Is this correct? Anyway, if you can send me your sample workbook at support@ablebits.com, I think we will be able to help better.

  13. Amarnath says:

    Thanks for this awesome blog !!!
    Yet i could not crack this.

    I have value in cell a1 to a5 and b1 to b5. Column a is output of path1 and column b is path2. Now i need to compare value of column b with column a and color column c with 3 colors using data bars to show the magnitude.
    1) green : if column b value is lesser than a
    2) yellow: if column b value is equal to column a
    3) red : if column b value is lesser than column a

    Now the c column should have a data bar to indicate how good or bad the value in column b is compared to column a. I spent too much but i eventually end up forgetting my location !
    Can you shed some magic on this please

    • Hi Amarnath,

      3 data bars of different colors cannot be displayed at the same time in one column. But you can try this way:
      - Enter the following formula to cell C2 that will calculate the difference: =B2-A2
      - Copy the formula across the entire column C.
      - Apply the Green Data Bar to column C (negative values will be colored in red).

      To hide the values and leave only the data bar visible, click 'Manage Rules' under Conditional Formatting, double-click your Data Bar rule and select the option "Show Bar Only".

      As an alternative, you can consider using sparklines.

  14. Carl says:

    I have a situation in which I'm applying conditional formatting to data that can be in three different ranges. For example if a cell has a value below a certain number, it colors green, if it is between two values, it colors yellow and if it is higher than a value, it colors red. I have this part down with three separate rules.

    However, these ranges will change based on gender, which I have in an earlier column. Therefore, there are two different sets of three rules I want to apply to a row of data. What I want is that if C3, for example, reads female, then three specific conditional formatting rules will be applied to J3 which would be different than if C3 read male.

    I would love any help you could give me.


    • Hi Carl,

      It is not possible to create a conditional formatting rule that would force another rule or set of rules to apply to a certain range of cells. Instead, you can create 6 separate rules combining both conditions in one formula, e.g.:
      =AND($D3>0, $C3="male")

      If you are looking for something different, please send me your sample data at support@ablebits.com and we will try to figure out the proper formulas.

  15. Amarnath says:


    Thank you very much for your time on this. That was helpful and again informative. I will use this suggestion.
    You have an awesome blog here. Thanks.

    Make it a great day !

  16. Jared says:

    I am making a spreadsheet and want to highlight specific duplicates. Like if a name pops up 3 times I want it green...4-9 times I want yellow. and 10+ times to be in red or something. What rule do I want to set up for this? Do I have to find the first instance of a name and create each rule based on that?

  17. Jared says:

    Nevermind...figured it out. I'm dumb

  18. Mike says:


    I have conditional formatting set so that the fill turns green if it equals a certain number. There are 5 numbers that meet that criteria in a row, 4 of them turn green and the 5th one does not. They all have the same formats and formulas. Do you know why it is leaving out that one number?


    • Hi Mike,

      The most obvious reason that comes to mind is that the format of the problematic number is different from all others. You can try to copy the format from some other cell where the rule works well to that problematic cell using Excel's Format Painter. Also, make sure your formatting rule applies to the entire rows. If neither is the case, you can send us your workbook at support@ablebits.com and we'll try to figure it out.

  19. Jessica says:


    If I have a set of numbers is there a way I can use conditional formatting to highlight the number in that set that is closest to zero?

    • Hello Jessica,

      Thank you for your interesting question!

      If your data set consists of positive numbers only, you can use this simple way:
      - Select your data set.
      - Click Conditional formatting > New Rule... > Format only top or bottom ranked values.
      - Under "Format values that rank" section, select "Bottom" from the drop-down list and put 1 in the box next to it.

      If your data consists of both positive and negative values, then a solution is a bit more complex. I've added a couple of examples to the post because this is really a very interesting question and other users may find the examples helpful. Please see How to highlight the nearest value in a data set for full details.

  20. Michelle Davis says:


    I have conditional formatting on my dates and they turn color based on 30, 60 90 days past due date. What i need next is to change my status column to match the date colors. I have status' of Open and Closed. If they are open they should match the color of the date, red, orange or green if over certain days, if it is closed it can remain black. Any help is appreciated.

    • Michelle Davis says:

      I forgot to mention I was using this formula with no luck - just turns everything red for open =IF($K2>30,$C2="open","")

      • Hi Michelle,

        I'm not sure I completely understand the task, so let me check. You have a status column C that contains words "Open" or "Closed", this is absolutely clear. You have another column K with what kind of entries - numbers or dates?

        If numbers, you can change the color of your Status column by creating 3 conditional formatting rules with a simple formula like this:

        If dates, then please provide more details on how you determine the past due date. If you can send me your sample workbook at support@ablebits.com, this will be a faster way : )

        • Michelle Davis says:


          they are dates. They turn color based on 30, 60 and 90 days past the due date. I need the status column to do the same if they are Open and Closed so that we can monitor what is not done on time. Maybe there is another way?

  21. Sergio says:

    Hi, first thanks for your great blog!
    I am trying to get the cells on column A to change to green when F, G and H contains "Done" or "N/A". I has tried a couple of different formulas but no luck.
    It should be something like:
    If you find some time, can you guide me to the right solution please?

  22. Carl says:


    I tried to send my sample workbook but I keep getting an error!

    It says: "The error that the other server returned was:
    550 5.1.1 : Recipient address rejected: User unknown in virtual alias table"

    Please help!


  23. SHARADA says:

    I have a problem in excel format date is in one sheet and my condition


    • Hi SHARADA,

      Sorry, I am not sure I understand your formula. Why are 'XXXXXXXX' encapsulated in apostrophes while YYYYYYY aren't? And what is '12' VSD? I think it will be easier for me to understand if you can provide a sample of your data.







  25. Alison says:


    I am trying to get a cell A2 to fill green if cell B2 says Approved or fill amber if cell B2 says Pending. Cell B2 will always start at Pending and then will be overtyped with Approved as and when, and would like cell A2 to update itself based on this change. I have tried a number of ways, but can only seem to get the formatting to change for one or the other not both. I'm sure I have used conditional formatting for something like this before. Is there anything you can suggest?

    Thanks :-)

  26. Sarah says:

    I have a roster schedule that uses conditional formatting for each day based on where the employee is (OT/ AL/ Work/ Off tour etc) What I would like to do is highlight the entire column of what day it is today.

    Ie column HE is today's date (29 July) I would like the entire column (which has other conditional formatting values and then blank cells) to be a certain colour so it is easier to navigate back to what day it is.

    I have the 'TODAY' date formula in cell A1.

    Have tried various ways and can get the single cell (HE) to highlight, but not the entire column.

    Thanks for any help

    • Hi Sarah,

      I think you can handle it in this way:

      - Select the entire table without column headers and create a rule with either formula:
      =A$3=TODAY() or =A$3=$A$1

      Where A is the first (left-most) column of the table and 3 is the row with dates (table headers).

      Depending on what you are trying to achieve, this rule should be either the 1st or the last in the list of conditional formatting rules.

      If it is the 1st, the column will change the color but individual cells might get colored in different ways based on your other rules. If it is the last, the entire column will change the color overriding all other rules.

  27. Harrison says:

    Hi Svetlana,

    I feel I'm really close to receiving an answer in this article. If you see "Compare 2 Columns for Duplicates", it doesn't have an explanation as to how I can have excel put these matching cells on the same row (your picture is a great example of my problem). I need them to be on the same row because I have data attached to the duplicates that changes monthly (however, the name remains the same). Do you know how I can have the rows match up?

    Thanks in advance for your assistance!

  28. Chris says:

    I need to highlight any cells that contain an absolute value rather than a formula i.e. the formula has been overtyped with a value. Is this possible with conditional formatting?

    • Hi Chris,

      If you use Excel 2013, you can create a conditional formatting rule with the below formula (where A2 is the top-left cell of your range):

      If you use Excel 2010 or lower, you will have to add User Defined Function (VBA code) to your workbook because ISFORMULA was introduced in Excel 2013 only. Here is the function:

      Function IsFormula2010(ByVal cell As Range)
      IsFormula2010 = cell.HasFormula
      End Function

      If you do not have much experience with VBA, these step-by-step instructions will be helpful.
      After the above code is added, you can create a condition formatting rule with the same formula:

  29. Lisa says:

    Hi - this is a very useful site! I need to format cell C5 to say 'YES' if cell B5 is greater than 100, and for C5 to say 'NO' if it is less than 100. I am sure that this is very simple but I can't work it out! All conditional formatting seems to be to colour a cell or text, but not to put a work in a cell… Thank you :)

  30. JBarringhaus says:

    I have a workbook where I have work order numbers in column a and start dates in column f, in another sheet I have work order numbers in column d and start dates in column h. I need to be able to highlight a row if I have 2 different dates for the same work order number - Thank you so much

    • Hi!

      Simply select the table where you want to highlight rows (without column headers), let's say in your sheet 1, and create a rule with this formula:

      Where F2 is the top-left cell with dates in sheet 1, H2 - the top-left cell with dates in sheet 2, and Sheet2 - the 2nd sheet's name.

  31. Pri says:

    Hi Svetlana

    Hope you can help. Would you know how I can apply conditional formatting to a table where the row colours alternate as the column value (text) changes?

    For example: the column values are car, house, bird, table, anything else, and when the value changes, the row colour changes (2 colour choices). I can't apply a colour to each value as they are not all known. I just want two colours to alternate as the value changes so it's easy to spot the change.

    Thanks in advance.


    • jormonal says:

      I hope this is not a "too late" comment: you can apply a new rule to the same range. The only condition is that you do not apply the same format for different values. Now: if you do not know what are the values (as they will be appearing appear in your table) you can have a list of new values and mark in your table any new item (not contained in your list) with a special color or mark. You can use a formula from LOOKUP or similar do detect if your table has or not the "new value" in your master list...

  32. Pri says:

    Thank you, Svetlana.

    Very useful, although if you know a way I can run this without having to create an additional column that would be even more awesome! :)


  33. Josh says:


    I have been working on a pivot table for receiving of parts for a specific product. Different parts for the product are received from different vendors. I am creating a file that will take raw data from sheet 2 and easily show and format the cells for each grouping of products when all the parts have been received.

    For example, product 1 is listed 10 times in column A because it has 10 parts to it before it can be built. Column C shows if the part for the product has been received. What I would like to have done is once the report I paste into sheet 2 shows that all parts have been received for product 1 in column C, to then highlight the name "Product 1" in column A in green. I would also like this to repeat automatically for every other product in column A when all parts in column C are showing received.

    Thanks for any help!

  34. Eric says:


    Please help
    I have 2 sheets. I have a list of items on 1st sheet, it has item code (A1) next to it is description (B2) and so on.

    I am making sheet 2 with description only (populated from quickbooks). How do I make a formula to add the item code corresponding to its description on a cell next to it.

    Not all items are in the 2 sheet and they are in different order compared to the 1st sheet

    Thanks in advance

  35. Brian says:

    I am creating a scheduling template for a staff of hundreds of employees. I need to make sure I do not schedule an employee wore than 5 days in a given week. How can I highlight cells if a specific name occurs in a block of cells, say b7 - h15, more than 5 times?

    • Hi Brian,

      Try creating a rule with this formula:

      Where A is the column containing the employees names and A2 is the first cell in a block with a given name. Please pay attention to the use of absolute and relative cell references.

    • Brian says:

      =COUNTIF($B$7:$H$15,B7) >5

      figured it out.

      • Brian says:

        OK, here is a step further. Is there a way to highlight cells based off the same block of cells over multiple tabs. I tried "=COUNTIF('Batch Review:Rotary Opener'!$B$9:$H$28,B9)=1" and received and error saying that I could not use this reference in conditional formatting.

        • Hi Brian,

          Conditional formatting rules require a more traditional formula format : ) Try out this one:
          =(COUNTIF('Batch Review'!$B$9:$H$28,B9) + COUNTIF('Another sheet'!$B$9:$H$28,B9) + COUNTIF('Rotary Opener'!$B$9:$H$28,B9) ) = 1

  36. c says:

    Hello, I want to create a numeric series starting with 1 based on the value entered in a column.
    For example:

    In column d, row 7, the value entered is 3, then column e, will automatically enter number 1, 2, 3 to rows 7-9.

    Then if I enter another value on column d, row 10 say for example 2, then column e will automatically enter 1 and to to rows 10 and 11.

    Please help

  37. c says:

    I tried using this formula but then after it satisfies the first input value it will not do numeric series when inputing the next value

    =IF(ROW(A1)<=$D$7, ROW(A1), "")

  38. Simon says:

    Hi Iam trying to enter a formula that returns the following

    In cells in Column J I will be entering employee names against locations in Column K, I then need Column M to return programmed and the whole row to be highlighted in Green,

    However if Column J returns RBS I need column M to return programmed but the row to be highlighted blue

    • Hi Simon,

      I am sorry, I do not understand what "to return programmed" means and what RBS is. Can you please clarify?

      • Simon says:


        What I would like to achieve is:-

        I have 15 employees who work in different teams, I would like to set up a formula that when I type the employees name (ie C Reed) into cell K2 cell N2 is populated with the word Programmed and the entire row is highlighted in green, but if I typed RBS into cell K2 Cell N2 is still popultaed with Programmed but the row is highlighted in blue.

        Thanks for helping

        • Hi Simon,

          Thanks for the clarifications. Then you can try creating 2 rules with the following formulas:

          Blue: =AND($K2="RBS",$N2="Programmed") This rule should be the first in the list, with the option "Stop if true" checked.

          Green: =AND($K2<>"",$N2="Programmed")

          • Simon says:

            Hi Sorry

            I dont think I made it clear that if I typed RBS or my employees name in to cell K2 I would like the word Programmed to automaticaly appear in Cel N2 and the row to either highlight Blue if Cell K2 contained RBS or Green if an employees name is typed into cell K2

            Thanks for your help

            • Hi Simon,

              Just enter the below formula to cell N2, and then copy it across the entire column:

              This formula will enter the word "Programmed" in column N once you type an employee name in column K in the same row.

              And then, you can create the conditional formatting rules with the formulas I suggested earlier to color the cells in the way you want.

  39. David says:

    I have a case.If i type a text "IN" in cell A1, the next cell B1 should be blank.No other values could not be typed in that cell.in same way if a description is already in cell B1 and if I type text "IN" in cell A1 it should get automatically deleted.Pls help me out.

    • Hi David,

      If column B already has any values, I think conditional formatting won't work. This task requires a macro and you can try to find an example on some Excel-targeted forums like mrexcel.com or excelforum.com. I am sorry for not being able to help you.

  40. James says:

    Hello I am working on a retirement planning spreadsheet. I have keyed in a started working age, and a retirement age of 67. I need help in creating a formula that stops the series at age 67. For example, If I key in age 26, in my table, my series goes to age 71 bc I orginally formatted the table to have a basic start age of 22. I would like to be able to create formula that stops the series at age 67 regardless of the age you start working.

    • Hi James,

      Try nesting your current formula inside the IF function in this way:
      =IF(A2<=67, YOURFORMULA, "")

      Where A is the collumn with the current age, e.g. 22. Then А46 will have "68" and at this point the formula stops the series.

      If the above approach does not work, please send us your sample workbook with the existing formula at support@ablebits.com, and we will try to figure this out.

  41. Jocelyn says:

    Hi.. I have conditionally formatted a row of data to highlight the highest cost and lowest cost for a product (each cost in a different column - b,c,d,e).
    How do I copy this format down to 1457 individual rows, without having to paste the format to each row individually?

    • Hi Jocelyn,

      In conditional formatting rules, cell references are relative to the top-left most cell in the applied range.

      So, simply select all 1457 rows, and create 2 rules with the below formulas (assuming that B2 is the top left-cell in the applied range):

  42. RW says:


    I'm trying to format 3 columns of data. Each row of these columns needs to be formatted based on 1 cell in that row. I am trying to format each row given 5 variables for that 1 cell. Is there a way I can do this?

    Thank you.

    • Hi RW,

      I believe this is possible. However, to be able to suggest a formula, I need to know a bit more about your data. If you can provide an example of what exactly values you have in each of the 3 columns and what condition you want to base the formatting on, I think I will be able to help better.

  43. RW says:

    Thank you. It's for a fantasy football draft, so the 3 data columns are Player Name, Position, and Team.

    I want to base the formatting on Position. So, if Position = QB it shades all 3 cells yellow. If Position = RB it shades them green... and so on.

    • Thanks for the details, now the task is crystal clear : ) You can achieve the desired result in this way:

      - Select all the rows with data in those 3 columns, not including the column headers.
      - Create conditional formatting rules with the below formulas, assuming that column B is the "Position" column and row 2 is the first row with data:

      Yellow: =$B2="QB"
      Green: =$B2="RB"

  44. dxn says:


    So I am using Excel 2010 to keep a list of my exchange servers and all of the DBs at my company. I get a report mailed each morning and I take the values from those reports and import them into excel. From that data I create a bar graph using conditional formatting, but for some reasons the rules will not affect TWO CELLS. Only two. I have the rules setup to affect a range of cells from H6-H37. H10, and H20 simply do not respond to the rules I have configured. I have tried everything...re-writing the rules, I even specifically set the range as those cells individually and the rule still wouldn't affect them. Any ideas?

    Thanks in advance for the help.

    • dxn says:

      Where is this pulling my picture from? That is creepy...

    • Hello,

      Most likely the problem is with the format of those 2 cells. You can try to copy the formal of some other cell where the rules are applied correctly using Excel's Format Painter. Did it help?

      Also you can check the list of rules in the Manage Rules dialog to make sure there are no other rules set for those 2 cells that override your new rules.

  45. steve swift says:

    I hope you can help with what must be very simple, but I can't get to work and no one else seems to have asked the question anywhere(perhaps because it is so simple LOL)
    I am keeping a record of electricity consumption by month. If for example the figure in B1(Jan 2014)is less than the figure in A1 (Jan 2013) I can conditionally format B1 to go green, but I can't for the life of me get B1 to remain clear if there is no figure in it. I'm guessing that a blank cell is less than any figure in A1? Is there a way to do it?
    Many thanks

    • Hi Steve,

      You are right, the solution is simple, though not obvious at first sight : ) You can achieve the desired result in 2 ways:

      1. Use the following formula for column B:

      The expression $B1<>"" checks whether a cell is not empty, and the AND formula applies the rule only if both conditions are met.

      2. In addition to your current rule, create one more rule of the "Format only cells that contain" type > Cell value > Blanks for column B. Alternatively, you can create a rule based on this formula =$B1="", which also applies to blank cells only. Do not set any format for this rule. Finally, make sure this rule is the first in the list, and select the option "Stop if true" next to it.

  46. Cathy says:

    Is there a way to move a whole row to a new sheet based on the contents of one cell? I have a column titled "loan status" and it is either marked with a "C" (closed) or "O" (open). I would like all the closed loans to be moved to Sheet2 once I change the "loan status" to a "C". Thanks.

  47. Geoff says:

    In one of my Columns I need to ensure that only 10 numbers are input. I would like the cell to turn yellow if any more or less characters are input. This will help to alleviate me having to track people down for corrections if they know immediately that they have input this number combination with to many or to few characters.

  48. Kevin says:

    Hi Svetlana,

    I'm a novice at conditional formatting and need your help to create conditional formatting rules to change font colours of a date value in a specific cell dependant on that dates relation to the current date, for a equipment rental tracking spreadsheet. I need to create the following rules: where return date is current day 'red' and lastly when a date is entered actual return date cell (different cell) 'blue'.

    • Hi Kevin,

      You can use the following formulas to create conditional formatting rules:

      Red: =AND($F2="",$B2>=today())
      Blue: =$F2<>""

      Where $F2 is the first cell in the column "Actual return date"; and $B2 is the first cell in the column "Return date", not including the column headers.
      You can apply the above rules to one or more columns or to the entire table. In the latter case, the whole rows will be highlighted.

  49. Jeremy says:

    I regularly use conditional formatting, but for whatever reason the correct icon colours won't show right away for only a couple of cells.

    But..as soon as I copy and paste the exact same values over itself, it works.

    Or if I open the conditional formatting rules and go to edit it, and click in one of the "value" boxes (not changing any values) and click "Ok" and "Apply" it works.

    Or if I highlight everything and unhide rows (even though no rows are hidden), it works.

    I have checked the parameters a hundred times, and it all appears correct, but it's not showing the right icons until I do either of these three things.


  50. Jeremy says:

    I should specify, I am using the conditional icon sets Green, Yellow and Red.
    Thank you!

  51. Alisa says:

    I am trying to find a way to incorporate conditional formatting into my behavior system in my school. Every time a student goes a week without having any behavior "marks" they get to move up a level. Is there a way to enter in the number of "marks" a student receives and anytime a zero is entered it changes colors. The hard part is that the second time they have a zero, I would like it to change a different color, as well as the third, fourth, fifth, and sixth time each different colors as well. Keeping in mind that the student may have zero marks one week, and then 4 marks the second week. Any assistance would be greatly appreciated! Thank you in advance for your time.

    • Hello Alisa,

      For us to be able to help you better, please send your sample workbook to support@ablebits.com. You can replace any sensitive information in your table with some irrelevant data, just keep the format.

      Also, please specify if you want the color to change for consecutive zeroes only, or they can be mixed with other numbers, e.g. 0, 0, 2, 0, 0.

      If the latter, you can use the following formula:

      Where $B2:$F2 are the columns where you enter marks during the week, "=5" is the number of zero marks for a certain color.

  52. Mahabaleshwara says:

    I have list of weeks like Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday. And have created a dropdown list for selecting any one. Have tried conditional formating to colour the selected week using lookup formula. But the same is not working even though the formula is correct.
    Weeks are listed A1:A7 and dropdown list at B1, formula I used for conditional formating was =LOOKUP($B$1,$A$1:$A$7)=$B$1
    Kindly help me with correct solution

    • Hi Mahabaleshwara,

      Do I understand it right that you want to format a cell in the range A1:A7 that contains the same day of the week that is currently selected in the drop-down list in cell B1? If so, then simply select cells A1:A7 and create a rule with this formula:

      As I explained in the article, in conditional formatting you write a formula for the top-left cell only and it gets applied to the entire range you've selected when creating a rule.

      If you are looking for something different, please clarify.

  53. Kevin says:

    Thanks Svetlana, but the questioned I originally asked seems to have been cut short, so I am listing again what I'm trying to achieve.

    I need to have the cells in a specific column colour code according to the rules below:

    - where return date is current date 'red' and lastly
    - when a date is entered in the 'actual return date' cell (different cell)'blue'.

    So assuming the 'return date' cell is B2 and the 'actual return date' cell is F2, can you please advise what the formulas would be for each rule listed above. Additionally, would I need to select 'use a formula to determine which cells to format'?

    Many thanks, Kevin

    • Kevin says:

      Again my comment above has been cut short the rules I need to create formulas for, so I will list them again below:

      - where return date is current date 'red' and lastly
      - when a date is entered in the 'actual return date' cell (different cell) 'blue'.

      • Kevin says:

        The list of rules keeps getting cut short in each post, so listing them again below:

        1. where return date is current date 'red' 4. when a date is entered in the 'actual return date' cell (different cell) 'blue'.

  54. Steven says:


    Great blog.

    I would love to find a simple answer to my question and would appreciate your help.

    Two columns A & B

    Column A has a numbers in it such as

    1000-50-50-5060-508150-000000-000-522500- Total
    6000-40-40-4030-409555-000000-998-522500- Total
    6000-40-40-4040-401220-000000-999-522500- Total
    6100-41-41-4110-411001-000000-004-522500- Total
    6300-80-51-8070-807010-000000-000-522500- Total

    Column B has a list of starting numbers such as

    What i would like is for Column B and the cell "1000-" (and other numbers) to be red if there are numbers in column A that start with "1000-" and the other numbers. I only need color in Column B. It seems simple enough but I cannot find a way to do it. I hope that you can give me the solution.


  55. TJ says:

    I need a formula I could use that will help me calculate the average of a group cells in one column based on the condition of another column. For example, I want to find the average for data in column D based on data in column E, but the data in column E must only be >750 and <1001. HELP PLEASE!!!!

  56. Stratis says:

    Great just to confirm I have noumerous list like
    A B
    1 3
    3 5

    etc. I want conditional formatting as follows
    Format all cells in colum B if the respecting cell is NOT blank and if
    the cell in column B is greater than the cell in column A
    =AND(A1"",B1>A1). the question is how to applying to all the column using respective or absolute values

  57. Patsy says:

    I want a row to highlight if one cell in that row is not empty, I have chose the row and then in the formula typed =NOT(ISBLANK$I15) and it only highlights the A15 if I put something in I15. this works if I just want to highlight one cell in that row

    • Hello Patsy,

      You can highlight the entire row if one or several cells in this row are blank using this formula:

      Where 5 is the number of columns, and 1 is the min number of empty cells.

      You can also use this simplified formula, where 4 is the difference between the 2 above mentioned numbers:

      • Patsy says:

        Thank you Svetlana for answering. I did not make myself clear. Column "I" is blank until a deposit is made and then I put a date there. When I put a date there someone else has to add data to our finance data system so I want it to highlight the entire row when I add something too Column "I" in order for them to see it at a glance. At first I was only highlighting one cell with the formula =NOT(ISBLANK$I15)). The other users felt like it would be easier to following if the complete line was highlighted.

        • Patsy says:

          Thanks everyone I found my answer after reading for two hours others problems, and I found someone that had a similar problem and I got it to work. Thanks

        • Patsy,

          In this case, simply apply your existing rule to the entire table. Click Conditional Formatting > Manage rules, and change the range in the box under "Applies to".

          Also, make sure all brackets are in place in your real formula, one is missing in the formula you posted here : )

  58. kiran chikte says:

    I have entered in first column category such OPEN,OBC,SC,ST etc then OPEN for 450, OBC for 250, SC for 100 without type the number in infornt of other col. automatically. How it is possible

  59. David says:


    How to use the function INDEX and MATCH together.Is it better to use than Vlookup?

  60. Y+toner says:

    I am trying to highlight duplicate data in 1 column only if they data in the next column are also duplicated. How do I do that?

    • Hi!

      You will need to insert a helper column. Suppose, the original columns are A and B, and column H is the helper column.

      - Type =A2&B2 into the cell H2 and copy the formula down column H.
      - Select columns A & B and create the conditional formatting rule to highlight duplicates with this formula:

      As an alternative, you can also use our Duplicate Remover add-in (the Color duplicates option) to highlight duplicates. In this case, you won't need a helper column.

  61. Emma Bennett says:


    I'm trying to create a conditional formatting rule, but nothing seems to be working, could you help.

    If cell Z3 is equal to or greater than 25 I want cell C3 to be green, if Z3 is between 15 and 24 inclusive I want cell C3 to be orange, if Z3 is equal to or less than 14 I want cell C3 to be red.

    I've managed to get simpler conditional formatting rules to work, but when I've gone to copy for the formula into other rows it wont work.

    Any suggestions please?

    • Hello Emma,

      Most likely, the problem is in using proper absolute / relative cell references in the formulas. You can find more information about different cell references types in this article: Relative and absolute cell references in conditional formatting rules.

      If you need to compare values in each individual row, select all the rows you want to format and create 3 rules with the following formulas (assuming that row 3 is the first row where the formatting is applied):

      Green: =$Z3>25
      Orange: =AND($Z3>=15, $Z3<=24)
      Red: =$Z3<=14

      In case you want to format all the rows based on the value in cell Z3, use absolute cell references in the above formulas, i.e. $Z$3:
      Green: =$Z$3>25

  62. Antoine says:

    I'm trying to setup a conditional formatting with the icon sets and I need some help!
    I've this situation:

    B C D E
    A1 Sell to 20 L
    A2 Buy From 25
    A3 Sell to 30 M
    A4 Buy From 5
    A5 Sell to 15 H
    A6 Buy From 2

    I've setup a conditional formatting check for A1B1 that says if there's an N,L,M,H change to appropriate color (easy!)
    However in the A2B1 (and in every other cells) there's a number that I'd like to have compared to the every other cells that refers to the rows "Buy From" using the icon sets (bars value)
    Is there a way to do this without manually select every other cells and apply the conditional check?
    Also, once I've created the conditional formatting(s) for the column B1, can I copy paste its properties to the other columns by dragging the source column in my worksheet.
    I hope I've explained my problem :-)

    • Hi Antoine,

      Sure, you can apply your rule to other columns. Go to Conditional Formatting > Manage rules, and change the range in the box under "Applies to".

      As for the icon sets, it is difficult to understand what data you have in the columns without formatting. Please send us your sample workbook to support@ablebits.com and we will try to help.

  63. Shannon Forsythe says:

    Hi Svetlana,

    I am trying to set up conditional formatting rules to evaluate the following excel spreadsheet.

    Actual value column to a Budget column value. Based on the Actual value column if it is 10% or less from budget value color yellow, if greater than 10% color red and if monthly value is equal to budget color green. I have set up 3 rules with Use formula to determine which cell to format, but it not doing what I want it to do?

    Rule 1 B5=C5 format green
    Rule 2 B5>C5*.10 Format Red

    I have tried using $B5 or $B$5 same results,

    any suggestions in accomplishing this task so I can have the color's automatically filled in? Thank you!

    • Hi Shannon,

      The rule with $B5 should work, assuming that row 5 is the first row in the applied range.

      If it still does not, please verify the following:

      - Make sure you entered the correct column names (B & C)
      - Probably, the Green rule shall be applied when a monthly value is equal or _less than_ a budget: =$B5<=$C5
      - In the Yellow & Red rules, you should multiply by 1.1, not by 0.1. (Red: =$B5>=$C5*1.1)
      - Check if your numbers are formatted as numbers and not as text (they should be aligned to the right, without a green triangle in the top-left corner of the cells)

      If none of the above suggestions work, please send me a sample workbook to support@ablebits.com and I will try to help.

  64. Nique says:

    Not sure if this can be done and I've tried a bunch of different ways to create a rule and keep coming up short. On my X axis I am using names. I know which names need to be in different colors. I cant seem to come up with the proper formula or rule to make this happen.The y axis which relates to $ has nothing to do with what I need the x axis to do so writing a rule to that end wont work. Any suggestions?

    • Hi Nique,

      Did you try selecting the entire table and creating a rule similar with the below formula?
      =A2="name" (where A2 is the left-most cell of the applied range)

      If this is not the result you are looking for, please send me a sample workbook at support@ablebits.com and include the result you want to get.

  65. Mark Ward says:

    Can I ask a question – trying to format a pivot table and highlight the last column where the value is under the avg – eg 57709 is below para – please highlight the “4”

    Do you know any other way ? other than manually


    57703 21 34 36 31 38 34 33 27 29 44 30 29 29 415
    57709 4 5 2 6 2 2 4 1 5 180 4 215 21.1 4 -17.1
    57712 25 20 21 23 28 32 25 17 30 17 27 24 28 317
    57715 9 8 16 7 15 16 7 11 13 9 113 12 20 256 19.66667 20 0.333333
    57901 1 1 1 2 3 1 3 2 2 1 1 5 2 25

  66. larry says:

    I found the reason my conditional formatting formula didn't work is that I used a lower case letter for the row label rather than upper case.

  67. Bradley says:

    I have a similar problem that is not listed under your manual. I'm doing a sales analysis from period to period and I need to be able to tell when sales for a certian product either drop or go up by 15% all the sales figures are entered in percents as well.

  68. Sameer says:

    Hi Excel Gurus,

    I want do following please help me how do I do this.

    I have set of samples taken which about 300000 samples in a column.Now I want to calculate average of every 1000 samples.

    Please help me how to do this calculationin EXCEL.


    • Hello Sameer,

      Try pasting this formula in any cell of the second row:

      Where A is your column with the data; -2 is the row number with the minus sign. Then copy the formula down to 30 cells.

    • Anonymous says:

      Hi svetlana!

      i m having problem in excel regarding below

      assume i have a value which is 10 in cell A1 and 20 cell B1 so i want to calculate these 2 columns or in result i want answer value with Text include by single formula.
      Suppose if i calculate through if condition e.g If(A1>B1,"increased by"A1-B1,"decressed by"A1-B1))

      the answer should be like this ( Decreased by 5 )/(Increased by (value))

      can u plz help me out of this??
      i hope u`ll understand what mean 2 say??

  69. Sherry Crosbie says:

    Is it possible to highlight only duplicate rows that are consecutive in order? Only duplicates on consecutive rows need to be highlighted. The field that is being compared is a text field -- a name.

    Thanks for any direction you can give me.

    • Hi Sherry,

      You can highlight consecutive dupes by creating a rule in this way:

      - Select the column where you want to highlight duplicates, without the column header.
      - Create a conditional formatting rule using this formula:

      Where A is the column with your data, $A1 - the column header, and $A2 – the first cell with data.

  70. Adam says:

    I am having an issue with Conditional Formatting. What I have is A3:I8 and I want to fill in all cells when cell B3 is blank. I have tried everything I can think of and nothing has worked. What would be the best way to accomplish this task?

    • Anonymous says:

      Hi svetlana! well thanks it was really worked it out.
      Hmmm...well svetlana can u tell me plz frm where i can learn advance Excel and VBA through online ??? so i can check the solutions by my self...??

      Thanks 1nce again..

  71. Hi Adam,

    Simply select the range A3:I8 and create the rule with this formula: =$B$3=""

  72. Lacy Fay says:

    I'm trying to setup conditional formatting as follows:

    Say Column A are dates that deliveries were scheduled e.g. 08/27/2014

    I want the conditional format of Column B to show just the scheduled month and year; for example the date in cell A1 (08/27/2014) should appear as Aug-14 in cell B1.

    Can someone provide the type of conditional formatting I should apply to Column B so that no matter the date in Column A, Column B will show that Month and year??

    I creating a macros and this is the final piece to the puzzle. Please and thank you in advance!

    - Lacy

    • Hi Lacy,

      I think conditional format is not needed for this task. You can enter the formula =A1 in B1, then copy it across the entire column B, and then set the format mmm-yy for column B (Format cells > Number > Custom).

  73. Sherry+Crosbie says:

    I am trying to highlight duplicate rows only where the duplicated information is on a consecutive row. The duplicated information is a text field -- two letter state abbreviations. Any ideas how to do this with a text field?

  74. shawna says:

    hi, i'm looking for a formula to highlight cells in a pivot if cell value is >= 20 and at least 4 consecutive cells. help! thank you.

  75. arun says:

    i want to know is there any formula to get freez (desire)coloum i.e.

    like if A1=1 than any one able to enter the value or text on G1
    if A1=0 than no one able to enter value or text on G1

    kindly help if you know

  76. jeelan says:

    i want to do conditional formatting based on another cell value.
    for ex:

    if cell(A6)= N, the formate of c8:p20 should be defined format,
    like that for different value of a6 the formate of c8:p20(defined formate) should change

  77. jeelan says:

    may i know how to do it

  78. Anonymous says:

    A B C

    149 86 554

    if less than value is 86 then who can we highlight B in another cell

  79. Rabia says:

    Hi All,
    I have two cells data as
    A10 : if(a = b)
    B10 : if((a = b) && (b = c))

    I want the cell C10 to be
    c10: if((a = b) && (b = c)), the extra chaecters are to be displayed in Bold RED colour.

    Please help

  80. LDkiwi says:

    My query is on conditional formatting with dates.
    I have a s/s which has the following columns:
    1. Date Contract sent out
    2. Date Signed contract returned (blank until it is returned)
    3. 7 days reminder
    4. 14 day reminder
    5. 21 day reminder

    If column 2 is blank, the highlight (I have this part done)
    If column 2 is blank and 7 days have elapsed since date in column 1 then format cell green
    If column 2 is blank and 14 days have elapsed since date in column 1 then format cell orange
    If column 2 is blank and 21 days have elapsed since date in column 1 then format cell red


  81. Zak says:

    Hi Svetlana,
    Great and very informative post.
    In a large range A1:AK100, I need to highlight the first cell (A:A)in a row if ALL cells in the rest of the row are blanks. Please note that all cells contain formulas that either return a value or "".

  82. Anonymous says:

    HI madaam,

    I want to create formula that when I input letter on a cell, ex. L on b5 then
    b6 will have letter v.

  83. Meenakshi says:

    i used coding in java, Excel - Using formula(String formula = "SUM(Vouchers!E2 : Vouchers!E"+(rec+1)+")";) to reference values on other sheets(Vouchers) get 0 only, i directly apply this formula in excel sheet, got 86123.67, but reference to other sheet got answer of #Value, why this happen?

  84. Hamed says:

    Hi there,
    thank you for the great text. i recently downloaded an spreadsheet from excel built-in template called "Gantt project planner". I was wondering have you seen that file, I couldn't figure out how it used special formatting. If you can't find it. please let me know to explain more. anyway, I copied them in the following,
    Actual =(PeriodInActual*(project!$E14>0))*PeriodInPlan
    ActualBeyond =PeriodInActual*(project!$E15>0)
    PercentComplete =PercentCompleteBeyond*PeriodInPlan
    PercentCompleteBeyond =(project!BY$8=MEDIAN(project!BY$8,project!$E17,project!$E17+project!$F17)*(project!$E17>0))*((project!BY$80)
    PeriodInActual =project!BY$8=MEDIAN(project!BY$8,project!$E19,project!$E19+project!$F19-1)
    PeriodInPlan =project!BY$8=MEDIAN(project!BY$8,project!$C20,project!$C20+project!$D20-1)

    Thank you very much if let me know how these formulas work for conditional formatting.

  85. Carlos says:

    I wanted to utilize conditional formatting to highlight cells that are 90 days away from a certain date. Then if it passes that certain date to become red. Can someone please help?

  86. B says:

    I would like to use conditional formatting for multiple cells based on date. There are pending, completed and "blank" cells. I also need to create a tally based on the updated cells by location (I was thinking i could link the cell to a certain area within the sheet or even create a new sheet. I have six locations and I want to have the table "updated" automatically once a milestone has been completed? How can I do all of this for one sheet?
    Thank you! I need all the help i can get.

  87. Graice says:

    Hi Svetlana,

    I have a question related to the similar topic. Would you be able to advise if a cell can be formatted/ formulated based on the value of a range of data in a row?

    E.g. A row of data has been conditioned formatted to highlight the highest numerical value as bold blue while the rest which are not the highest numbers are in default black colour.

    In a separate cell, if I were to key in the highest value or other value, can the cell be formatted to show what is exactly in the range of data which was conditioned formatted earlier?

    Thanks a million!

  88. Michael says:

    Hi Svetlana,
    Could you please help with the below conditional formatting
    I have a product (orange)
    I have Stock on Hand (SOH)of 95Kg (CellD2) and I have and order for today of 45Kg (F2)and tomorrow 40Kg (G2).
    Then I have a stock on order (SOO) of 100Kg (E2)
    What I need is:
    Highlight my orders in yellow when my SOH cover the QTY ordered then
    Highlight my orders in red when my SOO cover the rest of my orders
    Ultimately no highlighted cells if SOH and SOO doesn't cover my orders
    Below example:
    The 95Kg of SOH cover 24 and 25 of September with 10Kg left over
    With my SOO of 100Kg plus the 10 left from SOH, (110Kg)cover the 26 but not the 27
    Therefore (24 and 25) should be yellow, 26 should be red, 27 no highlight
    Can you help
    DC Article Description SOH SOO 24/9 25/9 26/9 27/9
    656 369558 Oranges 95 100 45 40 56 75

    • Hello Michael,

      You can use the following formula to create the "yellow" rule:

      Also, make sure the "Stop if true" checkbox is selected for the "Yellow" rule in the rules' list.

      The "red" rule should look as follows:

  89. iansmeema says:

    Wonderful tutorial!! Thank you so much!!

  90. Arun says:

    Thanks. This tutorial is brilliant. I used it to color my bank statement xls. It helps identify the Debit and Credit transactions in just a glance.

    Color Red for

  91. Glenn says:

    Hi, Good morning
    Can you please help me with my formatting problem.
    I have an work sheet with several column. I need to format a column based on the other column. eg; column B will be Appreciated IF column A says Positive Behaviour.

    Thanks in advance


    • Hello Glenn,

      Conditional formatting is not needed for this task. Simply put the following formula in cell B1 and then copy it down column B:
      =IF(A1="Positive Behaviour","Appreciated","")

      If your data starts, say, in row 2, then replace A1 with A2 and copy the formula in B2.

  92. Glenn says:

    And if column B is appreciated column D will be the same date as column C.

    Thank you


  93. Glenn says:

    Hi Svetlana,

    THANK YOU very much

    It's really a BIG help for me...

  94. Glenn says:


    Again I want to ask for your help...

    I have spread sheet and I need a sum up.just like this

    if value in column A was duplicated the value in column B and C in that row will automatically sum up.

    Thank you

  95. David S says:

    Very nice blog!

    I have a list (top to bottom) of let's say 100 customers, and their monthly sales (so Jan-Dec, right to left).

    For each customer (ie, each line) I want to use Conditional Formatting to highlight each customer's best 3 months.

    I can certainly do conditional formatting on each of the 100 lines, one by one, but that is extremely burdensome. Is there some way to highlight all 100 lines and all 12 months and have excel know to do it line by line and not just pick the three best results out of the whole range (1,200 cells)?

    Thank you VERY MUCH!

  96. David+S says:

    kept looking and found the answer on another site:

    Highlight the entire area (all columns and rows with data); manage rules; create new rule, where A1 is first cell and O is last column:


  97. Adam Dore says:

    So I am creating my own budget sheet for uni, and I have almost done it. I am just stuck with one problem.

    Based on my grant, I have £11.52 a day on average. This is £80.64 a month. To make sure I don't overspend (as we get a lump slum every 3 months) I am basing the budget on a day to day format.

    My problem is, Say I spend £10 on the first day, this leaves £1.52. This money can then be split over the 6 other days meaning I would have £11.77. However, I can not find a formula that will allow me to do this. Say I spent £6.00 on my first day of the week. I would then have £12.10 for the other 6 days. Then if I continued to under spend, My daily budget would increase.

    It currently looks like:

    Date Daily Amount Spent
    02 October 2014 £11.52 £0.00
    03 October 2014 £11.52 £0.00
    04 October 2014 £11.52 £0.00
    05 October 2014 £11.52 £0.00
    06 October 2014 £11.52 £0.00
    07 October 2014 £11.52 £0.00
    08 October 2014 £11.52 £0.00
    Total Left £80.64 £0.00

    Any answers anyone

  98. Raineek says:

    This blog has been very informative, but I have not found an example of my problem yet. I simply want to highlight duplicates (preferably not the first occurrence) only when the values in two other columns match. In other words, I would like to find duplicates in column C only when the values in columns A and B are the same.

    I've tried countifs formulas, but they are not working. I wonder if I need to use a match statement or something similar. Any advice would be greatly appreciated.

    Many thanks.

    • Raineek says:

      I read over my comment and realized that it may be unclear that I want values WITHIN columns A and B to match, not match each other (for which I found an example). For example, duplicates would be highlighted in column C when values in column A = 1 and values in column B = 2, then duplicate searching would start new when values in either column A or B change.

      Thanks again.

      • Hello Raineek,

        If my understanding is correct, you want to highlight C3 if any of the above cells contain the same value and if A3 is equal to B3.
        If so, select the column C starting from C2 till the end of the table and enter this formula:

      • Raineek says:

        So, I have been continuing to work on this problem and I have the correct formula to highlight duplicates in a column if values within 2 other columns match. For example...
        However, I am having a hard time to avoid highlighting the first instance in this case with multiple columns.

        I would also like to have a separate column that has a formula resulting in a "0" value when it is the first or only instance of a value in column J, only when the values within B and E columns match. Right now, based on something I found that explains how to do this in one column, I've tried to modify to include multiple columns like this formula...
        =IF(COUNTIFS($B:$B,$B2,$E:$E,$E2,$J:$J,$J2)>1,0,NOT(COUNTIF($J$2:J2,J2)=1)),but I don't think it is dealing with the multiple columns well.
        Again, advice on this would be appreciated.

        • Raineek,

          I'm not sure I can completely follow you. If you need to highlight duplicates rows by comparing rows by several columns and highlight only the second and further occurrences, this can be dome using VBA or our Duplicate Remover add-in. Sorry, I don’t know a way to do this using Excel formulas.

  99. Jean says:

    My query is on conditional formatting with dates.
    I have a spread sheet which has the following columns:
    1. Todays date $B$1
    2. Date entered for return of document $AJ4 lets say 3/10/2014

    If column 2 has the date 3/10/2014 then highlight 30 days prior in red.


  100. Woody says:

    I am trying to conditionally format an entire column based on the information from another column. For example, I want to highlight red in B1 a value less than that of A1. It will be green when greater than A1. I also want to highlight red in B2 when it is less than A2, green when greater than. So each value in column B needs to be highlighted with its corresponding A value. I just do not want to have to do this line by line for 50 items. Is there a way to do this all at once?

    • Hello Woody,

      Of course, there is no need to create a rule for each row. You simply select all the cells in column B that you want to highlight, say B1:B50, and create 2 rules with the following formulas:

      Red: $B1<$A1
      Geeen: $B1>$A1

      Since you use the absolute column (with $) but relative row (w/o $) references, Excel will adapt the formulas for each indibidual row and highlight cells in column B as you need.

  101. Susan says:

    I have duplicate values in Column B, and I would like to have the entire rows highlighted when a duplicate value is found in Column B only. Similar values may also be found in Column A, but I only want the duplicates from Column B to be considered when highlighting the entire row. How would I accomplish this? Thank you!

  102. AP says:

    Awesome thread, thanks a lot! Even though I didn't ask a question, my doubt got solved :)

  103. okieboy84 says:

    Hi Susan...Hopefully this isnt something that Ive missed, but I am needing advice.

    I am using conditional fomatting to format an entire row if column G contains a conveying document type (eg. WD, TD..)

    I higlighted the table, used:


    It worked great!!
    My question is, I want it to be the same color for WD, TD, Exec Deed,...etc. Is there a way to have all these words in one rule? Or do I have to make a new rule for each word?


  104. Jelena says:

    Is there a way to make the color associated with a conditional formatting rule dynamic?
    For example can I feed a value in cell A, a color in cell B, and make the conditional formatting formula's 'format' in cell C depend on the value of A but if true to present the background color indicated in B?

  105. Ben says:

    Hi Svetlana,

    I am trying to have any cells in Column Q that have an equal value as any cells in Columns A and B be formatted; with the values in Columns A and B continuously changing. I've only been able to input a successful formula that highlights equal values that are only within the same row. Thanks.

  106. Bobby says:

    Hi Svetlana,

    I am trying to get cells in a column to equal a value of 1 with numbers in the cells that could be 1-50,but the value of each cell still is counted as 1 so that I can get them to sum up at the end. Thanks.

    • Hi Bobby,

      If my understanding is correct, you need to count the cells in a certain column with values from 1 to 50, inclusive.

      If so, I can see 2 possible ways:

      1. Use the following COUNIFS formula:
      =COUNTIFS(A1:A10,">=1", A1:A10,"<=50")

      Where A1:A10 is your range of cells.

      2. Add a helper column with the following formula next to your column with numbers:

      It will populate a cell in the helper column with "1" if a cell in the same row in column A is between 1 and 50. Then simply use Excel's AutoSum to count 1's.

  107. Shubham says:

    Dear Svetlana,

    I want to use formula or conditional formatting for below mentioned condition:

    If i enter a date in one cell of column A and missed to enter some data in other cell of column B then color of cell of column B need to appear Red, and vice versa...

    Please reply ...

    Little Urgents..


    • Hello Shubham,

      You can create two rules as follows (assuming that row 2 is your first row with data):

      For column A: =AND($B2<>"",$A2="")

      For column B: =AND($A2><"", $B2="")

      • Shubham says:

        Hi Svetlana,

        Suggested formula works .....Thanks a lot.

        Could you please explain the logic behind as i have tried similar things but didn't succeeded earlier...

        Thanks a lot for the solution, you deserve a treat from my side..:-)

        • Shubham,

          I will try. The logic is actually pretty simple : )

          For column A:

          - You use the AND function to set 2 conditions.

          - Condition 1 - a cell in column B is not empty: $B2<>"" (<> means "is not equal to", "" - no value)

          - Condition 2 - a cell in column A is empty: $A2=""

          The rule for column B is analogous.

          An absolute column reference ($A - with the dollar sign) and relative row reference (2- w/o the dollar sign) tell Excel to adjust the formula for each individual row.

          Hope this makes sense.

  108. Christopher says:

    This would be a lot easier if I could show you a picture, but here goes. For example, I want my cells to turn different colors based on the text inside them. So if the cell reads "apple" I want that cell to fill with the color red. If it reads "orange" I want the fill to be orange and so on. The cells I want to be automatically colored will not be in one column, but between 3.

    Thank you for the help in advance and I look forward to your reply!

    • Christopher,

      Simply select the range of cells you want to color depending on their values, e.g. A2:C100, and create a separate rule for each word:

      Red: =A2="apple"
      Orange: =A2="orange"

      Where A2 is the top-left cell of the selected range.

  109. Kat says:

    I am working in Excel 2007. I need to know how to reference conditional format of a cell based on another cells value in a different sheet. Essentially, I want the color of a cell on sheet 1 to change too red, green, or yellow based on a percent delta on sheet 2. The percent delta could change and if it goes up, I need the cell to turn red, down to green, and same is yellow.

    I saw on a video that someone was able to do this by selecting the cell in the formatting rule, but my excel says, “You cannot use references to other worksheets or workbooks for Conditional Formatting criteria.” when I try.

    Thanks in advance!!

  110. Monique says:

    Good Evening Svetlana,

    I emailed you my spreadsheet earlier.

    I am trying to use conditional formatting with the stop light icon sets. I was able to get one to work.

    What I really need is for the parameters to be set based on the text from another cell.

    C3 says "Other", this could also say HC or MF.

    Opportunity Analysis (OAS)
    Name YRC
    Vertical HC/MF/OTHER Other
    Actual Total number of locations 400
    Number of "Open Market" locations 300
    Number of "Franchised" locations 100
    Shared Savings Fee % 45%
    Annual Waste Spend - Total 3,800,000
    Annual Waste Spend - Open Market 2,850,000
    Estimate % savings 20%
    $ savings (open market) 570,000
    Cass annual fee 256,500
    Cass net monthly fee 21,375
    Fee per location per month 71

    MF Stop Light
    Est. Fee per location per month > 85
    Proceed with caution 75 - 84
    Stop - See VP of Sales < 75

    HC Stop Light
    Est. Fee per location per month > 125
    Proceed with caution 115 - 124
    Stop - See VP of Sales < 115

    Other Stop Light
    Est. Fee per location per month > 85
    Proceed with caution 75 - 84
    Stop - See VP of Sales < 75

    Based on the parameters above, how can I use conditional formatting in C14 to be dependent on which word has been typed in C3?

    C14 currently holds the value 71 that was derived from a sum function =SUM(C12/C5)/12. C14 currently has a red background with a red light, but is not using C3 to base its rules off of. The rule is only coming from =$C$14. How can I get the parameters to apply "if C3 is this word" "then these rules would apply to C14"?

    Thank you for any knowledge you can spare.

  111. Ajay Verma says:

    Hi Svetlana,

    I want to use conditional formatting for monthly office time sheet. It has Time in and Time out column. I want to change the color of Time in column to change to yellow color if it exceeds 10:00 am.

    Looking forward for your response.

    Ajay Verma

  112. Ajay+Verma says:

    Hi Svetlana,

    I want to use conditional formatting for monthly office time sheet. It has Time in and Time out column. I want to change the color of Time in column to change automatically to yellow color if it exceeds 10:00 am.

    Looking forward for your response.

    Ajay Verma

  113. dketter says:

    I need some help. I want to add values In column c where column d equals a term i.e account and display it in a cell on top.

    C5 2 d5 account
    C6 5 d6 boo
    c7 2 d7 account

    But I need a way to search the whole column as a range because I am adding new rows daily

  114. Mihai says:

    Hi there,
    I have a table with 10 rows, 10 columns and another table as a bingo ticket (which has 3 rows and 9 columns, with 5 numbers on each row, randomnly distributed).
    What I want to do is, if I enter a number (between 1 and 100) in my first table, the cell with a matching number in the bingo ticket will switch to a preformatted colour.
    How can you do that ? I have tried with lookup and index functions, but without any success... :-(

    • Mihai says:

      Finally, I found it...
      In the ticket table all the cells will have a colour formatting based on:
      Formula is =COUNTIF(first_table;cell)

  115. Hilde says:

    Hi Svetlana. Thanks for your very interesting postings !

    I want to use conditional format to highligh cells in a row when there is an "X" filled in in that row; this works with the formula =ISNUMBER(MATCH("X";$B2:$M2;0))

    Now I want to add a rule that only the cells before the "X" and the "X" itself are highlighted, but NOT the cells after the first "X" in the row.

    Could you help ?
    Thanks in advance,

  116. Debbie says:

    I want to apply conditional formatting to underline whenever there is a new customer. The spreadsheet is sorted to group customer orders together in rows. Each order is in one row and the customer name is in column B. I want to take it a step further and apply this to a macro for daily application to daily orders which may range from 60 rows to 500 rows.

    Please help.

  117. Keriann says:


    I need a little help on what I think is a fairly easy formula, I am just having trouble finding exactly what I want.

    If the date in C23, let's say it's 10/22/14, is between TODAY()-30 and TODAY()+30 then I want cell D23 to be filled red if it is still blank within that time frame.

    Basically my spreadsheet will be tracking due dates in column C I have the date the document is due and in column D I have when someone turns in their document to me. So I want to be able to track if it is due in the next 30 days or up to 30 days late, if the date is between -30Today+30 and the cell in column D is still blank I want it to be filled red.

    Hopefully that is clear enough. Thank you.

    • Hello Keriann,

      This is crystal clear, thank you : )

      Select cells in column D you want to color excluding the column header if any, and create a rule with this formula:

      Assuming that row 2 is your first row with data.

  118. Brian Cooley says:

    I'm trying to use conditional formatting to highlight a cell in a column red if the value of the cell is > 150% of the average of the values in the column. I've tried and tried,but nothing I have tried works. Can you please help?

  119. Susan says:


    I'm trying to configure an "and" statement - I think.

    I have a number of upcoming "jobs", all down column A. For each job, there are a number of "tasks", all across line 3. When a task for each job is completed, I simply put an x in the corresponding box.

    My jobs all have a different start dates, and as of right now I have the estimated start date in column C. When the upcoming job starts within in 2 weeks, it highlights the cell orange using =AND(C4-TODAY()>=0,C4-TODAY()<=14). When a job has started, it highlights the cell red using =C4<TODAY().

    Is there any way I can double-conditional format, where if a job is coming up within two weeks and some of the tasks for that job have not been completed, it will highlight that cell? Same with once a job has started. Thank you very much.

    • Hello Susan,

      If my understanding is correct, you have each task in a separate column, say columns D-F. And you want to highlight a job that is coming within the next 2 weeks if _at least one_ task column is not filled with "X".

      If so, you just need to embed the OR statement in your formula, like this:
      =AND($C4-TODAY()>=0, $C4-TODAY()<=14, OR($D4<>"X",$E4<>"X",$F4<>"X"))

  120. Carlos Mars says:


    Nice Work!

    I want to know if is it possible to change the color of a cell when rollover another cell?

    For example: if I get my mouse over the cell A1, the cell B4 change its color.

    Thanks in advance.

  121. Jason says:

    Select a value from a drop down, then that selected drop down value (flags) changes a cells color on a different sheet depending on value selected from drop down.

  122. Subha says:

    Hi Svetlana,
    I have a data table and column Q is drop down list of an application status. Column P is populated with some values. My requirement is if a specific drop down value is selected from Col Q the corresponding col P value should become zero.
    I have tried conditional formatting but it is throwing up circular reference issues. Can you please help?
    Also, I have always admired the name Svetlana!!

    • Hello Subha,

      It is not possible to change values in cells using conditional formatting.

      You can enter the following formula in Cell, say P2, that will populate it with 0 once "Value1" is selected in cell Q2, otherwise, cell P2 will be empty.
      =IF(Q2="Value1", 0, "")

      If you want to change the current value in column P based on the section in your drop-down list, then a special VBA macro is needed.

  123. Liana says:

    Reference: 120 80 Diagnosis

    Measured: Systolic Dialatic Systolic Dialatic
    Patient 1 111 75
    Patient 2 105 75
    Patient 3 104 80
    Patient 4 126 86
    Patient 5 120 69

    Rule: Measured blood pressure -
    - can be lower than the reference by 10 (0~10 lower are OK);
    - can be higher within 5 (0~5 higher are OK)
    - 11 ore more lower is diagnosed as "Lo BP"
    - 6 or more higher is "Hi BP"
    So the words "Hi" or "Low" wil lbe displayed
    in the range of D6:E10

    I need a formula for systolic using a Rule: Can you help me please

    • Hello Liana,

      Shall we check these criteria "11 ore more lower" and "higher within 5" against both Systolic and Dialatic? Or "11 ore more lower" applies to Systolic and "higher within 5" applies to Dialatic? Also, in what columns do you have Systolic and Dialatic numbers of your patients and in what cells you have the corresponding reference numbers?

  124. Musadiq says:

    Hi team ,
    i need to format a cell if another cell contain Yes ,

    A1 contain Yes

    Now I need to apply conditional formatting on B2 if A1 contain "Yes"

  125. Ben says:

    Drawing a blank.

    If I want to set a condition format with an icon set where I get a "check mark" for zero and and "x" for anything greater than zero.

    Seems very simple but I am not wrapping my head around it at the moment.

    • Hi Ben,

      I have experimented a bit, and the following settings seem to work fine. Under Conditional formatting, click Icon Sets > More Rules and then set up:

      X when values is >o (type - number)
      "check mark" when <=o and >=0 (type - number)
      X when when <o (type - number) (X will also appear for values less than zero, if any; or you can choose any other icon for this).

      Hope this helps.

  126. Gopal says:

    A really good post. Thanks.

  127. Cathy says:

    I have a spreadsheet with about 5000 rows. One of the columns is "File Status" that is filled with either a "A" (for active) or "C" (for closed). Is there a way to move a whole row based on that column to a new worksheet. Ideally, we would work from the worksheet with all the "A" files and when we close the file, we change the "A" to a "C" and the whole row could be moved to the sheet for Closed files. Also, if we reopen a file, is there a way to put on the Closed sheet a formula to move "A" files back to the original sheet?

  128. kac1171 says:

    How can I set a conditional format, that will highlight a cell that changes in value upon refreshing its data load?

  129. claytyyy says:


    I need to edit / fill cells if a certain cell in the row contains 'Yes' or 'No' with the contents of cells from another sheet.

    For example,

    On Sheet1, If B2 = 'Yes' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet2.

    And on sheet1, if B2 = 'No' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet3.

    How do I manage this, I have been trying all day!

    Thank you in advance for any help you can give.

  130. Gary says:

    I am attempting to write a conditional format that allows me to see when the value in one cell is larger than another, then shade the larger cell darker as the difference becomes greater.

    A1 = 95
    A2 = 96

    In the above example, A2 is larger and would become filled with a color,the difference is 1. But if the difference were 5 (A2 = 100) then I would want cell A2 to fill a darker shade.

    I tried using standard deviation and color scales, but because there are only 2 number being compared, it does not seem to work the way I had hoped.

    Thank you for any advice you may have!


    • Hello Gary,

      I am sorry, I don't know a way to fulfill your task using Color Scales. As an alternative, you can try creating several rules based on formulas:

      =AND(A2-A1>=0, A2-A1<=2)
      =AND(A2-A1>=2, A2-A1<=5)
      =AND(A2-A1>=5, A2-A1<=10)

      • Guga says:


        I was having the same issue and I manage to solve it using Color Scales. :)
        Try the following:
        - Select the range (a1:a2 in your example) and enter in the Conditional formating > New Rule > Format all cells based on their values
        - Select 3-Color Scale
        - In the "Minimum", select Type "Formula" and write the following formula: "=MIN($A$1:$A$2;1)"
        - Let the Midpoint with the percentile
        - In the "Maximum", select Type "Formula" and write the following formula: "=MAX($A$1:$A$2;100)"

        The further the diference between the values of the cells, considering a potential maximum of 100 and minimum of 1, the darker de cell color.

        Hope this helps.


  131. Shaun says:

    Hi Svetlana

    Great source of information. I came across it searching for a solution to a problem I have. In one column (say column 'A') I have a list of activities that need to be completed. In another column (say column 'B') I enter the percentage of the task in column 'A' that has been completed. I would like the first column to be filled with a data bar based on the percentage that has been entered in column 'B'. Probably dead easy but I can't figure it out. Be really great if you can help.


    • Hi Shaun,

      Unfortunately, it is not possible to fulfill your task using Data bar, or at least we don't know how. Data bar works only with the information in the same cell.

      The only alternative we can suggest is to insert a helper column to the left or to the right of column A, enter the formula =$C2 there and copy it down to other cells. Then you can apply a conditional formatting rule to this column by selecting the Data Bar format style and turning on the "Show bar only" option.

  132. Lisa says:

    I am trying to figure out a formula that will identify the same number within a column, and within that range compare the sums of 2 other columns to see if they are equal, with an output of anything ("same", colour whatever) or to just be left alone if the sums don't add up.
    Invoice # Dr Cr
    111 14 0
    111 0 12
    111 0 2
    222 4 0
    222 0 3
    would result in
    222 4 0
    222 0 3

    Is this possible?

    I have over 26,000 lines of data that need to be identified by an invoice # if the Dr don't equal the Cr...please tell me there is a way!!

  133. claytyyy says:


    I need to edit / fill cells if a certain cell in the row contains 'Yes' or 'No' with the contents of cells from another sheet.

    For example,

    On Sheet1, If B2 = 'Yes' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet2.

    And on sheet1, if B2 = 'No' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet3.

    How do I manage this, I have been trying all day!

    Thank you in advance for any help you can give...

  134. Hi,

    For this task, you need a usual IF function rather than conditional formatting. For example, these are the formulas for cell B3:



  135. Alex says:

    I have a pivot with conditional formatting. I now need to add more columns of data to the pivot. When I do that the column references called out in the conditional formatting don't change and I lose the formatting.Is there a way to do this without losing the formatting?

  136. Neelakshi Nehru says:

    Hi, I want to apply conditional formatting for "not equal to" clause. The cell is getting highlighted if I choose from the provided options like equal, greater than but not getting highlighted if I manually enter a formula for not equal to. Im using this formula : =$D25490
    Thanks !

    • Neelakshi+Nehru says:


      • Hi!

        This formula does not look correct (maybe was distorted when publishing). Anyway, if you can specify what exactly cell(s) you want to highlight and based on what exactly condition (not equal to a certain number or another cell?), I think I will be able to suggest the right formula.

        • Neelakshi+Nehru says:

          The not equal to operator did not get published! Anyways, I have a column named cost code under which I want to highlight all the values which are not equal to 5490.

          • Our blog engine often cuts off the "not equal to operator" in comments, argh! Anyway, your formula (=$D2<>5490) is correct. Just make sure you are selecting the entire cost code column (without the column header!) when creating the rule, and row 2 is your first row with data.

            If the rule still does not work for you, you can send me your sample worksheet (support@ablebits.com) and we'll try to figure this thing out.

  137. Andy says:


    Can you help me please?

    If cell A1 = 1, I want the maximum value in the range B1:B5 to be highlighted red. If cell A1 doesn't = 1 then no conditional formatting needs to take place.

    Any ideas?

  138. Ken says:

    The techniques you outlined work great unless you have data in merged cells. My "applied to" cells are merged. It appears that the formatting chosen in the merge dominates the conditional formatting. If I set up my conditional formatting, then double click in the cell, I can see the result of the conditional format, however as soon as I leave the cell, the formatting is gone. Any way to remedy this?

  139. Benny says:

    I have a formula for my sheet with vlookup..for ex:In the cell A2 if i type "Apple" than the rest of the cells in the row gets filled up automatically like B2 with "fruit"
    C2 with"Red".But if SOMEONE TRIES TO CHANGE THE FORMULA for ex.. enter something other than the "fruit" in B2 or other than "Red" in C2 the color of the particular cell should change to red and No fill when they change the values back to formula...

    Thank you very much in advance!

  140. Ben says:


    I have a spreadsheet for cashflow that tracks down my everyday expenses. On another tab, i have a consolidated tracker that includes my businesses and investments. The problem is i keep on substituting a certain entry in the consolidated tracker because i dont know how to reflect the latest cash i have base on the cash flow tab as of the current date. Here is the example:
    Cell A Cell B

    20Nov14 $500
    21Nov14 $400
    22Nov14 $350
    23Nov14 $100

    cash as of today: ????

    I wanted excel to always pickup the cash based on the current date. Let's say today is 23Nov14.


  141. Ahamed says:

    Is it possible to include multiple conditions using both AND and OR operators in the formula for conditional formatting. Can you please provide a syntax for this.?
    Thank you in advance!

  142. Nazmul says:

    I want to color a cell based on another cell value.
    if cell D1 contains "false" I want to get red color in cell A1.
    How can i do that?


  143. hamood says:

    if i have two dates on one cell. i need to change the color if the send date added

  144. Rushi says:


    If I want to write a conditional formatting that for example it should find for me if the fifth number in a certain cell is 0 then make the cell red
    how do I write it

  145. Ian says:

    Hi there,

    I don't know if you can help me but it's worth a try! I am looking for a conditional formatting formula that will help me do the following...

    If cell A1 is a colour (i.e. determined by conditional formatting rules) then make another cell the same colour without changing the original function in the second cell.



  146. Ranganath says:

    I am having spreadsheet containing D cell value K cell value , what is the formula for if K value is not equal to D cell value ?

    Please reply.

    K.R. Ranganath

  147. No need says:

    if i have one date, that date is smaller than other date. for this which formula i can use

  148. MW says:


    I am trying to format a cell if it is greater than another cell. Basically if the result is greater than the criteria?

    Criteria Results
    0.7 0.220 0.213 0.555 3.240
    5 0.800 0.064 0.324 0.585

    Any help on why this formula isnt working??
    Where Cell A is the criteria and B is the result


  149. Steve says:

    Hi Svetlana

    I am trying to change the cell colour of rows based on the change in value. Similar to Subtotal.... for each change in column B....

    so if I have

    I would like the colour for Rows 1 - 3 to be red, then white for 4th row then red for row 5 - 8

    Is it possible?


  150. Ashley says:

    Hi Svetlana, Great blog here!

    I think my problem is quite simple, and may have been covered in earlier examples but I am still unclear through trying!?

    I have a value of "Yes" or "No" in Column F, and want to colour this column/these cells based on a date in the same row, Column D:

    Amber: If 30 days overdue i.e. <NOW()-30
    Red: If 60 days overdue i.e. <NOW()-60

    Can you help??

    Many thanks!


  151. C. says:

    How do I conditionally format a table so that in column J when the word "Complete" is entered it highlights rows C to J in green?

  152. Michael says:

    Hi Svetlana,

    I am trying to do conditional formatting of email addresses to quickly identify addresses from gmail, hotmail, and yahoo. After a lot of looking online, I found a formula I could use:


    (Sheet 2 A1 - A3 are: A1= gmail.com, A2= hotmail.com, A3 = yahoo.com)

    However, when I put this in my conditional formatting - it only highlights those addresses with gmail in them and ignores the rest. I'm not sure what I am doing wrong. Any ideas?


    • Hi Michael,

      The point is that you have an array formula and array formulas can't be used in conditional formatting rules. In your case, the formula turns into =NOT(ISERR(SEARCH(Sheet2!$A1,A1))) and highlights only gmail addresses.

      You can pick the domain name in a row and use the MATCH function to find matches in your lookup table using the following formula:

  153. NAZMUL KARIM says:

    I want to change a entire row color for a cell value of the row... If i have 'fail' in a certain cell (D1) then i want to highlight row 1. How can I do that?

  154. Roger says:

    I have text from a drop down list (NO and YES) in Cell B2 that I want to use as the basis for conditional formatting elsewhere in the spreadsheet (to color a number of cells in a certain row red), but the formula (=$b2="YES") does not seem to recognize the text - if I insert the text manually rather than use the drop down list it works just fine. Any suggestions?

    Thank you.

  155. Jeff says:

    Please help me, I have a spreadsheet,eg A1:P245, I would like to be able to do is delete/clear any cells that contains a particular text.

    For example the cells may contain the following data
    P1abc P1gvh p2erg P3fgh sro34 sro56 srj67

    How do I clear the cell that start with P
    How do i clear the cells that contains ro

    Thanks you.

  156. Omer says:

    Is it possible to give a colum like "stable" or "ascending" the directional icons?
    Like if stays "stable" then must be ↔ and for "ascending" ↑.
    I i want use now the directional icons, i must give a number. I want in text.

  157. G says:

    Hi there,

    I'm trying to compare column A with a table, for example column B and if there is a match the match should be colored. Column B contains a output that had several decimals. The match does not need to be exact, ideally I would like to scan for a range of about +/-0.5 of column B. Does anyone have a suggestion how to approach this?

    ColumnA ColumnB ColumnC
    Output1 Output2 Addition to column B
    260,1 201,123 b2
    262,1 242,105 y4-NH3+2
    330,2 250,618 y4+2
    338,1 269,161 y2
    351,1 306,134 y5-H2O+2
    372,1 306,625 y5-NH3+2
    372,8 315,139 y5+2
    416,1 320,197 a3
    418,1 330,181 b3-H2O
    348,192 b3
    370,655 y6-H2O+2
    371,147 y6-NH3+2
    372,170 y3
    379,660 y6+2
    417,213 a4-NH3
    427,197 y7-H2O+2
    427,689 y7-NH3+2
    434,240 a4
    436,202 y7+2
    444,224 b4-H2O

    For example 330.2 matches 330,181 (with addition b3-H2O)and so they should be filled in with red. 372.1 matches with 372,170 and thus y3, the should be colored orange etc.

    Look forward to any help,

    Thanks, regards,


    • G says:

      Output 1 Output 2 Addition to column B
      260,1 201,123 b2
      262,1 242,105 y4-NH3+2
      330,2 250,618 y4+2
      338,1 269,161 y2
      351,1 306,134 y5-H2O+2
      372,1 306,625 y5-NH3+2
      372,8 315,139 y5+2
      416,1 320,197 a3
      418,1 330,181 b3-H2O
      348,192 b3
      370,655 y6-H2O+2
      371,147 y6-NH3+2
      372,170 y3
      379,660 y6+2
      417,213 a4-NH3
      427,197 y7-H2O+2
      427,689 y7-NH3+2
      434,240 a4
      436,202 y7+2
      444,224 b4-H2O

    • G says:

      Hmm the table didn't come out as it supposed to..

      Output 1 Output 2 Addition to column B
      260,1 201,123 b2
      262,1 242,105 y4-NH3+2
      330,2 250,618 y4+2
      338,1 269,161 y2
      351,1 306,134 y5-H2O+2
      372,1 306,625 y5-NH3+2
      372,8 315,139 y5+2
      416,1 320,197 a3
      418,1 330,181 b3-H2O
      348,192 b3
      370,655 y6-H2O+2
      371,147 y6-NH3+2
      372,170 y3
      379,660 y6+2
      417,213 a4-NH3
      427,197 y7-H2O+2
      427,689 y7-NH3+2
      434,240 a4
      436,202 y7+2
      444,224 b4-H2O

    • G says:

      Oops the table didn't appear as it should be..

  158. G says:

    Oops the table didn't appear as supposed;

    Output 1 Output 2 Addition to column B
    260,1 201,123 b2
    262,1 242,105 y4-NH3+2
    330,2 250,618 y4+2
    338,1 269,161 y2
    351,1 306,134 y5-H2O+2
    372,1 306,625 y5-NH3+2
    372,8 315,139 y5+2
    416,1 320,197 a3
    418,1 330,181 b3-H2O
    348,192 b3
    370,655 y6-H2O+2
    371,147 y6-NH3+2
    372,170 y3
    379,660 y6+2
    417,213 a4-NH3
    427,197 y7-H2O+2
    427,689 y7-NH3+2
    434,240 a4
    436,202 y7+2
    444,224 b4-H2O

  159. Emory says:


    I want to format a column of percentages, dependent on the column of percentages to the left of them.

    Highlight in green if the value is between 2% and -2%
    Highlight in amber if the value is between 2% and 4%, and -2% and -4%
    Highlight in red if the value is above 4%, or below -4%

    I'm sure this is easy, but i cannot get my head round it. I think it could be to do with how the rules are ordered in the manage rules section, but not sure.


  160. June says:


    I want to format a column of cells to fill in depending on when a specified date in another column has passed. For example I input the date into column "b" and then Seven days after that date has passed, I want Columns D,E,F to fill green. I am having trouble creating a formula depending on a date, any help offered would be appreciated.


  161. Yoris says:


    I have a workbook in excel and I want to know what article/type/value which is clicked or typed frequently in excel. But, I don't know how. can you help me?

    Thanks :)

  162. Yoris says:


    I have a workbook in excel and I want to know what article/type/value which is clicked or typed frequently in excel. But, I don't know how. can you help me?

    Thanks :)

  163. G says:

    Oops the table didn't appear as it should be...

  164. sakthi says:

    in my worksheet, i have two columns, one is alphabet (column B) and the other one is numeric (Column C).
    my condition is:
    if column B is L, then column C should be 1
    if column B is V, then column C should be 2
    if column B is T, then column C should be 3

  165. CM says:

    I'm using Excel 2013. I have not found a solution to this problem. I have a spreadsheet with 100 rows. The values in column P are numbers that are independent of each other. They range in value from 1.00 to 60.00. The values in column O range from 0.00 up to the value in column P for that row. I want to have each cell in column O in my worksheet use a red-yellow-green color scale conditional format, where the low value is zero, the middle value is one-half the value in column P for that row, and the high value is the value in column P for that row. I can create this conditional format for any one row easy enough. I can't find any way to copy it to the other 99 rows because the cell references in the color scale conditional format need to be absolute. It would be a lot of manual work to create this conditional format for each row one at a time. Is there a lower-effort mechanism available to do this?

  166. Alex says:

    Hi, thanks for the helpful posts. Though I am struggling with the following:

    I want to color column B depending on column A. And result columns (say E to X) should be dependent on B (it's like a matrix of column B). My guess is I mix up relative and absolute cell-links. Or I don't get how to copy the rule for a cell to others, i.e. I can create the rule for a single cell, but not the full column.
    A B ... E F G .... X
    Positive 44 =B1 =B2 =B3 ....
    Positive 43 =B13 =B14 =B15 ....
    Negative 40
    Positive 50
    Uncertain 42
    Positive 49
    Negative 20
    .... ...

    Very greatfull for any tips or solutions.

  167. Alex says:

    sorry, formatting went wrong, hope you can read it
    for every space there should be a tab.

  168. Ali says:

    Hi, I am a bit desperate here... I have searched everywhere but I can't find a solution to my problem. I really hope you can help me! So here it is:

    My issue is with the conditional formatting using a formula. To summarize, I want G3 to be highlighted if F3 is more than or equal to 0 and also G3 is smaller than 90% of F3.

    This is the formula I have entered in the conditional formatting but it doesn't work:
    ="AND($F3>=0, $G3<$F3*0.9)"

    Thanks for your help in advance :)

  169. Shasti says:

    Pls help me with this.
    Sheet 1 has to be a summary sheet that shows the consolidated values of # of open positions at onsite/offshore and for a particular month in sheet 2.

    Sheet1 resultant table should be something like this
    Status Dec-14 Jan-15 Feb-15
    Open 1 2 2 4 0 2
    Selected 0 2 1 1 2 3
    Identified 1 0 0 1 0 0

    Sheet2 values will be like this
    Name Status Location Start date
    X Open ONSITE JAn-15
    Y Open Offshore FEB-15
    Z Selected Offshore Dec-14
    XX Identified Onsite Dec-14
    YY Selected Offshore Feb-15

    Pls help me

  170. Eric says:

    Hi Svetlana,

    I am trying to enter a formula that will color a row based on the values on two sheets matching. If I have a series of telephone numbers on one sheet and I have sheet with phone numbers on a second sheet, I want to highlight the row on the first sheet that has a matching phone number. I want to do this for the complete sheet.

    So far I have managed to highlight the matching cells on sheet 1 using the following formula:

    =COUNTIF('Sheet 2'!$D$2:$D$71,D2)

    with a format to color the cell yellow applied.

    That will obviously only highlight a cell if a matching number is found on sheet 2. I need to be able to color the row.


  171. nazmul says:

    How can i make a calender in excel using formula (except using visual basic)?

  172. Lee says:

    Hi Svetlana.
    My problem would not appear to be too difficult but I cannot find a way to make this work.
    I am working on a rota for staff. In cell 1 I have a time 8:00:00 which is the start time. In cell 2 I have a finish time of 16:00:00 which i want to highlight in red using conditional formatting if the start time is = to 8:00:00. I'm sure this is easy but I'm stumped!

  173. Amber says:


    I need to conditionally format a cell based on the conditional formatting of three other cells.

    for example
    A1 is Green
    A2 is Green
    A3 is Red
    so I want A4 to show as Amber

    Is this possible and if so how do I do it?

    Thanks in advance

  174. Jen says:

    Hi Svetlana,

    I need help searching a range of cells for information that may be contained in another spreadsheet. I have two spreadsheets which contain information for hundreds of entities, one for 2013-2014 members and another for 2014-2015 members. What I would like to do is identify new members by searching the Tax IDs in both sheets. If the Tax ID is found on both sheets, I would like it to do nothing. If a new Tax ID is identified on the 2014-2015 sheet, I would like it to highlight red.

    Thank you in advance!

  175. Aneesh Thakker says:

    I want to color red a particular set of data if it contains data which is in a particular column using conditional formatting. what formulae should i use. i am not able to give an array in the formulae

  176. Salah says:

    can somebody help to solve this for me please? In excel 2013 I have a column where I have put some values.
    e.g. In D1 cell and I want to give conditional formatting to E1 cell that it becomes red in background if the value in D1 is less then 50% and it becomes Yellow in background if the value in D1 is greater then 49% and it becomes Green in background if the value is equal to 100%.
    Note: E Column I want to keep empty for the specific color as explained above.

    Thank you in advance for your support. Regards,

  177. Krish says:

    Hi ,

    I have a question, in my case 1 particular cell say A1 is done with a conditional color formatting so that the color of the cell changes with the value input in it. What I want is that the same cell color should be done for another cell say A2.
    Could you please advise.Thanks

  178. Suma says:

    I am trying to highlight entire row based on a cell value

    Wxample: I want my formula to highlight entire row where cell value = MH000038, when I am giving the below formula excel is not considering the zeros it is removing

    Rule created = $C2=MH000038
    Excel converting it to =$C2=MH38 so no cells are highlighting

    any help will be appreciated.

  179. npratt says:

    I would like to create a conditional formatting rule for the following:

    Cell C2: If cell C1=36 then the text in C2 would be 3x/8 weeks, 2x/6 weeks (36)

    Once that is completed, I'd like to create additional conditional formatting rules for the same cell.

    Is that possible?

    • Hi Npratt,

      I'm not sure I exactly understand the condition. Assuming that you want to put the text 3x/8 weeks in cell C2 if C1 euqals 36, otherwise - 2x/6 weeks (36), here is the formula for cell C2:

      =IF(C1=36, "3x/8 weeks", "2x/6 weeks (36)")

  180. Tatiana says:

    Good day!
    Hope you can help, as I tried everything and nothing works:
    I have two columns (Sales in 2013 in one columns, and sales in 2014 in another column - this is made depending on customer). Now I have to figure out, from a glance, which customer bought more in 2014, which less

    Column A B C
    Sales in 2013 Sales in 2014

    Purchaser 1 2131442,93 1783657,38
    Purchaser 2 295638,22 2609,31
    Purchaser 3 1733348,19 865579,68
    Purchaser 4 1472991,01 418399,35
    Purchaser 5 1490602,99 120403,99
    Purchaser 6 2927921,82 2729046,74
    Purchaser 7 452169,39 392953,53
    THank you for your help.

  181. Bria says:


    Simple request. I have had trouble finding the proper way to do this. I want to be able to enter a name in a cell on Sheet 1 of the MS Excel Workbook (2010) and have that same name (or data) repeated in a corresponding cell on another Sheet in the same workbook as I enter it in the one place. Basically I need names of associates to appear in multiple places, but only want to enter it once. Any tips?

  182. Branden says:


    I'm currently using 2 sheets to keep track of client information. sheet 1 (client info) has columns listed as A1-SSN, B1-Lastname, C1-Firstname, D1-Phone#, and E1-paid (which is blank since the service occurs before payment) and each column has about 100 entries of the information. Now in sheet 2 (payments) I have the same columns listed in the 1st row and a vlookup formula in all the cells so that when I enter the SSN number in A2, the rest of the 2 row fills in with the names, numbers, etc. My question is how do I make it that when I enter 'yes' under the payment column (E2), my sheet 1 with also fill in 'yes' in column E for the right client?

    Thank you for any help you can give

  183. Mohamed Kamal says:

    I have a problem of replacing a cell value if th background color of the cell is Yellow: for example

    Column A B
    1 2
    1 2

    I would like in a new sheet to put in (column A) 1 or 2 depends on the Yellow color in A1 and B1,
    so if A1 is highlighted in Yellow then put in the new sheet A1 code 1 if not then put 2

    How I do that?

  184. Will says:


    I am trying to run down a large list full of one's and zero's. If it is zero, then the corresponding row, 2 rows to the left, value I do not care about. If it is a one, I then want to essentially add it to a mixing pot with all of the other values that have 1 corresponding with them, then find the max value of all of them. HELP!?

    • Hi Will,

      I understand that you have a list of 0s and 1s but I'm not sure I understand the task. Can you please try to describe it in the following way:

      -if cell A1 is 0, then do what?
      - if Cell A1 is 1, then do what?

  185. saeed says:

    tanx for your most useful tips
    I have a question
    I wanna write formula that says if you search a number in column b by Crtl+f
    and it finds it the near column (column a) type ok and it change the color of it automatically...
    is it possible anyway?

  186. Paul says:

    Hi Svetlana, I'm having a problem trying to find if the numbers in a column are in a sequence or not.

    I want to highlight a cell whenever the it is not equal to the cell above it + 1.


    2 <-- HIGHLIGHT
    5 <-- HIGHLIGHT
    8 <-- HIGHLIGHT

    Thank you for your help

  187. Andrew says:

    I want to use the conditional formatting to color a column of cells based on "yes" or "no" in another cell. I tried walking through the steps above and got nothing. I also tried formatting it as a table and using the COUNTIF equation. I got it to work on a test cell but when I tried to duplicate it with the entire column I got nothing.

  188. AK says:

    Hi, I want to conditional formating rows based off of what is in two different columns

    Column1 Column2
    1 NG
    2 NG
    1 OK
    3 NG
    2 NG
    4 OK

    I have it set up right now that if its OK it hightlights the row gray and if NG it shows orange. I want to make it that if another entry is entered and it is OK but the first time it is NG it will change the row to gray. So for the example the first row 1 is orange because of NG but when you add in the second 1 with OK it will change the first row 1 to gray also.

    Thanks for the help!!

  189. Megan says:

    I would like to change my text value in column E and F based on the text entered into any cell in column F.

    For example: If I enter in any cell in column F "BBL" I would like the "BBL" in column F to be red as well as any text I enter in column E but only in that specific row. I would like this formatting to work for the entire spreadsheet.

    • Arjen says:

      Hi there..
      Been stuck with my project already.
      I have a value in column A.
      And i need to apply a 3-color scale on column B depending on the value of column A.
      If column A=<1 - column B turns red
      if column A=the value of column A - column B turns dirty white

      i think this is simple but im getting invalid formula.
      why's that? this is what i've been doing

      on column B3, i enter this

  190. Michael says:


    I am in desperate need of some help with something if possible.

    I am trying to conditionally format cells in a column (E, range 3-96) to:

    -turn black if the cell next to it in column D is blank and the cell in column E is also blank.
    -turn orange if the cell next to it in column D is blank but the cell in column E contains a time.

    Any ideas?

    Thanks in advance!

  191. Arjen says:

    Hi there..
    Been stuck with my project already.
    I have a value in column A.
    And i need to apply a 3-color scale on column B depending on the value of column A.
    If column A=<1 - column B turns red
    if column A= the value of A - column B turns dirty white

    i think this is simple but im getting invalid formula.
    why's that? this is what i've been doing

    on column B3, i enter this

  192. Arjen says:

    sorry for the double post. it changed.

    Hi there..
    Been stuck with my project already.
    I have a value in column A.
    And i need to apply a 3-color scale on column B depending on the value of column A.
    If column A=<1 - column B turns red
    if column A=<the half of A - column B turns yellow
    if column A= the value of A - column B turns dirty white

    i think this is simple but im getting invalid formula.
    why's that? this is what i've been doing

    on column B3, i enter this

  193. chris says:

    conditional formatting for cell B1- if cell A1=Optimize and B1 is greater than 0, red (or whatever)

    A1 B1
    Optimize 1

  194. Jordan says:

    This is a great list of conditional formatting uses! I have one I would like to see if you can tackle. I would like to highlight a range of values (item numbers) for a list of specific item numbers that qualify. The list may be small or it may be quite large. Would I need to do an OR function for each of the items in the list or is there a simpler way to get this done? Thanks!

  195. hassanhpk says:

    please help me
    I have this problem ( I create a conditional formatting to cell $I$2 (((cell value - less than - =$H$2-$H$2*10% )))

    is there away to create a conditional formatting to all cell below depend on the right cell like this

    (((cell value - less than - =$H$3-$H$3*10% ))) to cell $I$3
    (((cell value - less than - =$H$4-$H$4*10% ))) to cell $I$4
    (((cell value - less than - =$H$5-$H$5*10% ))) to cell $I$5

  196. Ahammad says:


    in condition formatting check the cell value, if it is true assigned zero in another cell how?
    Please kindly send the formula

    Ali Ahammad.

  197. Dhaval says:

    I am using MS Excel 2010. I want to use conditional formatting for B8 to B21 ( Format only Top-Green and Bottom-Red ranked values ) excluding 0.

  198. ERIC says:


    i have this check list with a checkbox, and i need to know how i can make the question status cell to display a text(done, pending) while changing the cell color (red to green),when i select one of the checkbox answer.

    ex. do you have a list of traces on PCB? []yes []no []n/a [question status]

  199. Christine says:

    I am trying to figure how to format the first cell in each row so that it will change to a color when all the cells are populated within that row (columns A-R). Some of the cells have text, some have numbers, and some have both. I am wanting to do this so that I know which rows are complete, without having to scroll back and forth and visualizing each one.
    Each month the number of rows I have varies, so it may be 90 one month, it may be 130 another. The first row is a title/header row. The first column is populated with names. Any ideas?

  200. Steven says:

    Hi, I've setup a training spreadsheet and added conditional formatting so that the cell turns red if the expiry date has passed (but only if the cell contains a value.


    Trying to setup an additional rule that turns it yellow if that expiry date comes within 2 months of the current date but not sure on the details of the formula. i thought something like this maybe but its not working.


    Any help would be greatly appreciated.

  201. Jann says:

    So if i want color fill in other cells by follow the date that i am input, How can i setup the formatting formulas?

  202. Curt says:

    Hi. This is a very helpful article. I am having difficulty solving this. I have a table where every cell is a formula. Some are straight references to cells, "=C2", and some are vlookups, "=VLOOKUP(C2,...)".

    I would like to highlight the cell only if the formula is a vlookup. Everything I see indicates that the conditions refer to the calculated values not the formulas themselves. I cannot use ISFORMULA() since all cells have formulas.

    I appreciate any help.

    • Alexander says:

      Hello Curt,

      If you use Excel 2013, then you are lucky. To fulfill your task, just select the table and create a rule using this formula:

      Where A2 is the top-left cell in the selection.

      If you have Excel 2010 or earlier, then you need to replace FORMULATEXT with VBA user-defined function (UDF)

      Function formulatext2(cellSrc As Range)
      formulatext2 = cellSrc.Formula
      End Function

      If you are not quite familiar with VBA, please see how to add a VBA macro (UDF) to your worksheet here:

      Replace FORMULATEXT with FORMULATEXT2 correspondingly:

      • Curt says:

        I appreciate the quick and helpful reply. I do have Excel 2013 and your solution worked perfectly. Unfortunately, my client uses Excel 2010 and will not allow vba in the workbook I am creating. So I am back to square one. If you have other suggestions I would be anxious to try them.


  203. Hilton John says:

    Hi Svetlana, Thanks for this article, it's very helpful. I just wanted to ask you how to highlight one empty cell in a column (say "B") when other cell(s) (one or more, say "A" & "C") in the same raw is filled with some values. And the highlight remains until the cell in "B" is filled with some values. Is that possible? your reply will be very helpful and is highly appreciated. Thanks in advance..

  204. Rachana says:

    Hi Svetlana,

    A very happy new year to you!!

    Please can you help on below query.

    Date From Organisation Details/Requirements Sent to Report Status
    10/02/2015 Pending

    A is a date column that records the email receive date and F shows the status pending.

    Now i want F to turn "pending" word in red if it crosses 5 days from date in A column. Please can you advise if i can conditional format it and how.


  205. Betty says:

    I have two columns, column A has various dates entered, column B has a formula =A1+30 meaning I want to see a date that is 30 days past the date in column A. I would like to add a conditional format to highlight the cells in column B when they have reached that 30 day mark. How do I do that?

    • Alexander says:

      Hello Betty,

      Select column B and create a rule using the formula below to mark only today's date:

      If you need to mark today and past dates, then please use this formula:

  206. Sarah says:

    I am wanting to conditionally format case sensitive values. For example, I want upper case "F" to be in green text and lower case "f" to be in blue text. I am using Excel 2010 and so far have not been able to google-cure my problem. Can you help?

    • Alexander says:

      Hello Sarah,

      Please use the Exact function and create two rules using these formulas:
      Green: =EXACT(H8, "F")
      Blue: =EXACT(H8, "f")

      • Sarah says:

        Alexander, thank you for the help. I discovered that my problem was not related to the formula (as I had tried the one you gave above) but that in place of the cell number I was putting in the full array of cells i wanted the formula applied to. I should have left it as exactly the formula you have above and then applied that formula to the array of cells, not actually include the array of cell names in the formula.... if you get what i mean.

        Thanks for your help!!!

  207. Heather says:

    I am trying to show icons for what I would think would be a simple task but I can't seem to make it work.
    In column "N" I have a current rate percentage. In column "O" I have a target rate percentage. I want to use the icons to show a green check if the target has been met, a yellow exclamation point if the target has not been met, and a red stop light if the current rate is 50% or more below the target rate. Basically just showing which rates have been met, are almost there, and are in danger of not being met.
    Can anyone help with this?

    • Randy says:

      Hi Heather,
      If you're content with just using color indicators instead of icons, the following should help:
      ***Please note, I'm using Office 2007, so this answer may vary depending upon which version you're using.***
      Assuming your data starts on row 2 (N2 & O2 in the example you describe; perhaps because you have a column header title), you should be able to get the appropriate colors to show by entering the following formulas into the Conditional Formatting -> "Use a formula to determine which cells to format" in this order:
      1) =$N2 Fill -> Background Color to RED)
      2) =$N2 Fill -> Background Color to YELLOW)
      3) =$O2 Fill -> Background Color to GREEN)
      Unfortunately, it'll take me a bit more time to figure out the solution using the icons you requested. I'm actually at work right now, was on this blog searching for an answer to a question of my own, ran across your question & figured I may be of service within a reasonable amount of time.

      I hope that helps.

      Best regards,


      • Randy says:

        Hi again Heather,
        I see that the equations I typed got messed up (not sure why), so I'm going to attempt to type these again, this time with spaces between items. Please note that the other info remains the same.
        1) = $N2 < $O2 / 2
        2) = $N2 < $O2
        3) = $O2 <= $N2

        Best regards,


        • Heather says:

          Thank you Randy! I will give that a try. My boss had her heart set on using the specific icons instead of colors, however I think I have convinced her that it just doesn't seem possible. :)
          Sorry for the delayed response, been in training.


  208. Catherine says:


    In Cell M4 I need to calculate whether a particular price (which is in another tab called pricing matrix)should be shown dependent on the figures in cell range C3:I52 (if these cells are zero value then the price in M4 is zero.
    However if there is a Y in any cell within the range K5:K52 then the price in M4 should be shown. I have inputted the below formula which sort of works however the cell M4 has lost the formatting for currency and decimal places. I have tried conditional formatting (I am no pro!) to no avail.
    CONCATENATE(IF(SUM(C3:I52)>0,'Pricing Matrix'!D26,0)&IF(K5="Y",'Pricing Matrix'!$D$26,0))

    Please help!

    Many thanks


  209. Alan says:

    Can someone help me with this conditional formatting problem?
    I have a spreadsheet as follows:
    Col A Col B
    10 74%
    9 72%
    8 70%
    7 68%
    6 66%
    5 64%
    4 62%
    3 60%
    2 57%
    1 54%

    Raw Score 57%
    Rating 2

    In general, how can I highlight the specific cell in Column B where it corresponds to the Rating of 2 (in Column A and reported in cell B13)?

    In this example I want to highlight the cell containing 57% in Column B since it corresponds with the Rating of 2 in Column A (and reported in cell B13).


  210. SAMIR says:

    Hi there I need solution for
    If cell A10 = any value
    Then cell A11 = 345 (fixed value)
    Any 1 can help?

  211. Anonymous says:


    I have a problem with conditional formatting. I have columns A and B.
    Row; Column A ; Column B
    1; -0,87 ; -0,96
    2; -0,57 ; -0,23
    3; -0,66 ; -0,65
    4; -0,74 ; -0,76
    300; -0,78 ; -0,87

    I have altogether 300 rows and two columns with changing values. I would like to highlight the values in Column B in green or red whether the value is greater than or less the value in Column A at same row that the value of Column B is. I know it is possible to manually create the rule for each cell separately, but I have 300 (!!!) rows. Can the rule be copied to other cells so that the reference changes like the rows change (Column B3 refers to value in Column A3 and B5 to A5 etc.)? So I don't have to create the rule for each cell separately.

    Thanks in advance!

  212. Moon says:

    Hi Svetlana,

    I have a table in excel. The cells in the table contain formula. When I click on one cell(say cell B2) how can I get those cells in the table highlighted where the values are greater than equal to {59/(clicked cell value)}.
    I am trying to use conditional formatting but can't implement both cell reference and condition function.
    Please help.
    Thank you...

  213. Virgil Tauchert says:

    Hi there! I could have sworn I've been to this blog before but after browsing through some of the post I realized it's new to me. Nonetheless, I'm definitely delighted I found it and I'll be book-marking and checking back often!

  214. Aaron says:

    Hi, I want to conditional formating rows based off of what is in two different columns

    Column1 Column2
    1 NG
    2 NG
    1 OK
    3 NG
    2 NG
    4 OK

    I have it set up right now that if its OK it hightlights the row gray and if NG it shows orange. I want to make it that if another entry is entered and it is OK but the first time it is NG it will change the row to gray. So for the example the first row 1 is orange because of NG but when you add in the second 1 with OK it will change the first row 1 to gray also.

    Thanks for the help!!

  215. Cedric says:

    Thank you for this very detailed tutorial!

    I was just wondering if it is possible to format a cell (or a whole row in a table ideally) based on an other cell's color? For instance I have a budget sheet with two tables. In my table where I add expenses, I created a Macro to add a new row, and pick a random color for that row. In that row, I have a cell indicating the day of the month that expense is due. I would like it if in my other table, the cell (or row) that corresponds to that date can automatically use the same background color.

    I hope I am not being too confusing haha. If so, I would just like to know if I could say: If this cell is that color, then this cell is also that color.


  216. Kam says:

    I'm hoping to get some help with a conditional formatting problem I'm having.

    I have two columns
    -First is a forecasting due date.

  217. Kam says:

    I have a conditional formatting challenge I'm hoping to get some direction on.

    I have two columns.
    -First column is forecasting a "due" date (this date is auto filled based on a previous start date)
    -Second column is requesting the "actual" date

    I'd like to conditionally format the second "actual" column/cell to go red in the event that it is blank and that the current date is equal to or passed the "due" column date. Once there is a date in the "actual" column and is no longer blank no color will apply.

    Thanks for your help.

  218. Zeeshan Majeed Bhatti says:

    I was just wondering if it is possible to format a cell (or a whole row in a table ideally) based on an other cell's color? For instance I have a budget sheet with two tables. In my table where I add expenses, I created a Macro to add a new row, and pick a random color for that row. In that row, I have a cell indicating the day of the month that expense is due. I would like it if in my other table, the cell (or row) that corresponds to that date can automatically use the same background color excel formulas: https://www.youtube.com/watch?v=ayVH-Y9-0M4.

    I hope I am not being too confusing haha. If so, I would just like to know if I could say: If this cell is that color, then this cell is also that color.

  219. Jadranko says:

    I wander if it is possible to conditionaly format the cells in a table where in a top row is writen which cell in a coresponding column (below) will be highlighted (the values in that column are not in direct relation with values in a heading row.
    Here is fragment of such table, where i want highlight 1st, 8th and 9th value (which coresponds to the first column (bins) - althogh that column is redundant)

    1 8 9
    bins A B C
    1 70 0 0
    2 53 16 0
    3 36 20 1
    4 32 20 6
    5 28 24 7
    6 25 27 10
    7 16 26 18
    8 17 25 21
    9 9 25 14
    10 7 16 20

    thanks a lot for your help.

  220. Rosemary Yoon says:

    I have been exploring for a little for any high quality articles or blog posts on this kind of space . Exploring in Yahoo I at last stumbled upon this web site. Studying this information So i'm happy to convey that I've a very good uncanny feeling I came upon just what I needed. I such a lot for sure will make sure to don?t fail to remember this website and provides it a glance regularly.

  221. Stacia Odriscoll says:

    If some one wants expert view concerning blogging and site-building then i suggest him/her to go to see this blog, Keep up the good work.

  222. N. Abby says:


    I am trying to use the conditional formatting tool. I have 2 columns quantity ordered, quantity shipped, and the percent difference. I would like the percent difference to be colored red if it is +/-10% and yellow if it is +/-5%. Can you please help?

  223. Trisa says:

    I'm trying to apply a conditional format to a cell based on the value of another cell. Here's what I'm trying to do:

    if the value in Cell G10 is 0 (based on this formula (f11-g9), then cellH11 will be green. HOWEVER, because cell G10 contains a formula, I can't make it work. If G10 is hardcoded with "0", then it will work. Any ideas?

  224. Kristen STL says:

    Thank you, this tutorial was very helpful to me!

  225. Admir says:

    A B C D E F
    start end est. work time|work days|days complete|days remaining
    2/4/2015 3/18/2015 30 30 10 15
    3/5/2015 3/19/2015 10 10 16
    2/23/2015 4/3/2015 29 29 27

    if F is more than C then I need it to turn green, and if F is less then C I need it turned red......
    Please help

    • Steph says:

      I have the same issue. I noticed all her examples are based on ROWS but i need columns.... I need my Column L to be wither RED OR GREEN according to cell Q1 which is a formula for TODAY "=TODAY()" I tried everything it seems to only apply ONE rule but it does not want to apply multiple. have you figured this out?

  226. Jan says:


    Good day!

    Need help here please. I have data that needs conditional formatting as follows:

    If Person 1 achieves 1 to 5 points it will show result "POOR"
    But if the Person 1 achieves 6 to 10 points it will show result "GOOD"
    But if the Person 1 achieves 11 to 15 points it will show result "VERY GOOD"
    But if the Person 1 achieves 16 to 20 points it will show result "EXCELLENT"

    Can anyone help me to have the right formula for this? Thanks in Advance guys!

  227. Kala Woodall says:

    Helpful information. Lucky me I discovered your website accidentally, and I'm stunned why this twist of fate did not came about earlier! I bookmarked it.

  228. Maddison Mungo says:

    Pretty great post. I simply stumbled upon your weblog and wished to say that I have really enjoyed browsing your blog posts. In any case I'll be subscribing for your rss feed and I hope you write once more soon!

  229. M.Hasnain Zaigham says:

    any formula which help me if i change value of 1st column and then change in amount in other column .....

  230. Febie says:

    Hi Svetlana, I have created rules that are now working just fine in a table I created (Rules 1-4 below). However, I want to create another formula that will override the first formatting when create a new rule (#5) so that the row turns purple when a new value is the designated column is entered.

    1) When YES=1.0, row from colA to colK turns GREEN
    2) When NO=1.0, row from colA to colK turns RED
    3) When ABSTAIN=1.0, row from colA to colK turns LIGHT ORANGE
    4) When ABSENT=1.0, row from colA to colK turns LIGHT GRAY
    5) When NP=X, row from colA to colK turns PURPLE

    Please help!

  231. DL says:

    I am almost positive this cannot be done with Conditional Formatting, but I figured I would ask anyways.

    Is it possible to Temporarily for a selection of Cells on Sheet2 based on Cell selection on Sheet1? Example: If Cell A1 is selected on Sheet1, I want Cells $A$1:$B$10 to be filled with Yellow, Bold, Italic, and Size 14 Font.

    Thanks in advance.

  232. Fred says:

    I am using Excel 2013
    When I copy values to cells that already have conditional formatting I find that sometimes the CONDITIONAL formatting is duplicated.

    Is there a way of copy / paste that stops CONDITIONAL duplications??
    Is there a way to remove CONDITIONAL format duplications

    Your help would be appreciated!!

  233. Siddik says:

    My requirement is ,

    I am trying to create check list . In column level I have all the days from JAN to dec. In row level I have assets to check. I need to highlight cells whcih will be 30 days next to the last updated cell.

    eg : I have ABC asset check on 1 st of JAN and the cell coresponds to 30 of JAn should be highlighted , which shows service is pending for that asset.

  234. Diana says:


    Your blog is very informational. Excel is fascinating. Thank you for posting.

    Is there any way to link cells with conditional formatting without Excel displaying the 0.00 and coloring the cells red? Excel 2010

    I have a spreadsheet where I have different tabs for each locations and then the last tab is all locations combined. I entered data in the locations combined tab and used the following conditional formatting to mark everything smaller that 0.85 red, but no coloring for the empty cells: AND(D1"",D1<0.85)

    It works perfect. HOWEVER, when I link these cells to the ones in the other tabs, all conditionally formatted cells turn red, and show the value 0.00. When I check the formula used for conditional formatting it is the same as the above with the cell name corresponding to the new one.

    Thank you in advance for your help.

  235. fylum says:

    Hi Svetlana,
    Very helpful! In your Formulas to compare values (numbers and text), I didn't see anything to indicate "between." I need conditional formatting in Col C to reference numbers in Col D. Cells in Col C should be light red if the numbers in Col D are between 51-79. How would I write that in a formula? =D1>=51...<=79

  236. Maggie says:


    can you help please?

    In an excel sheet like this and I want to highlight the highest value in each group, what formula should I use?

    Value Group
    819.23 1
    814.08 1
    808.47 1
    809.33 1
    805.7 1
    799.23 2
    796.79 2
    796.73 2
    791.25 2
    791.97 2
    784.52 3
    783.13 3
    788.61 3
    793.16 3
    789.4 3
    777.52 4
    773.03 4
    769.87 4
    760.69 4
    756.2 4

    Thank you so much!

  237. Nemish says:

    Hi Svetlana,

    I am trying to implement conditional formatting wherein if a cell contains any of the special characters it should be highlighted..i'm using the "text that contains" option for it..its working fine for every character except *..when i use it..it selects the entire column..any suggestions ?..another thing i wanted to ask was is it possible to do this entire thing through a formula using OR operator rather than setting a condition for each and every special character ??


  238. Dinesh Sharma says:

    my data contains lots of row & columns containing Numerical value data like:-
    A, B, C, D
    90, 80, 50, 40
    65, 45, 54, 55
    54, 85, 45, 26
    what i want is highlight the lowest value in each row in one attempt.
    I can highlight the lowest value in each row by applying Conditional formatting formula
    =A1=MIN($A1:$D1).by this formula i can highlight each row one by one but i need a formula by which i can highlight all the lowest values in each row in one attempt please help me on this its urgent

  239. Denise says:

    Hello Svetlana,

    I do not know if this has been asked.

    In my spreadsheet I want to highlight rows based on the content of colomn H which contains the open (red) or closed (green) condition.


  240. Bonnie says:

    Greetings! I read the areticle and most of the questions and responses above and still haven't a clue how to manage this conditional formatting issue.

    Working with dates makes it a little more complex, yet I think this can be done:

    For a row of data, compare the date in column F to the date in column C and the date in column E. Highlight cell in column F if either or both dates in C and E are later than the date in column F. In other words, the dates in C and E must have occurred before the date in column F.

    C = 3/8/15; E = 3/8/15; F = 3/9/15 == no highlight
    C = 3/9/15; E = 3/4/15; F = 3/8/15 == HIGHLIGHT
    C = 3/15/15; E = 3/15/15; F = 3/15/15 == no highlight
    C = 3/19/15; E = 3/20/15; F = 3/18/15 == HIGHLIGHT

    Please help!

  241. Vlasti says:

    Hi, I have spreadsheet with several columns and currently 151 rows. New rows are added regularly. After new row is added, I want to highlight lowest eight (8) values from the last 20 rows in one particular column. So right now, I want to highlight 8 lowest values in range (L132:L151). I know how to use array formula to find those 8 lowest values, but cannot figure out how to highlight them...

  242. Penny says:

    Hi, my data starts in cell A23. I will be adding numbers to column A, that will range from 1 to 300 or sometimes more. Once all of the numbers are entered, I highlight my work sheet starting with Row 23 and Sort by Smallest to Largest. I'm trying to do conditional Formatting (Excel 2007) so that I can immediately spot if I have omitted a number in the sequence. The formula I'm using in A23 is:


    Then I choose a color to format the cell if said condition is true.

    It shows up in the Conditional Formatting editing bar as the following and is not working:


    I also have a second condition in Column A for Duplicate Values which is working fine:


    Could the two be different conditions be the problem?


  243. Neeraj says:

    Thanks For the tutorial..

  244. Jeff says:

    Here is my dilemma:
    I have 1 spreadsheet with 2 specific columns containing times in minutes (Column V and W). I want to generate a conditional format that will highlight the entire row if both column V and W are greater than 60 minutes. I was successful if V alone is >60 using the following formula:

    I just can't figure out how to get it to do it for both V and W.

  245. Stephanie says:

    I need to compare 2 columns in 2 tabs in excel
    Tab 1 & Tab 2
    Column D has project#'s
    Column L has dates
    - both tabs have the same amount of columns, but count of rows will change

    Project#'s are not necessarily in order, but if they do match and the dates in column L match, it is ok.

    If the date in column L changes, i would like to see it highlighted in column L in Tab 1.

    Any help would be appreciated!!

  246. Nicole says:

    Hi Svetlana,

    I am trying to do highlighted conditional formatting for certain cells. When each cell is equal to 9.5%, it will be highlighted green. I pressed selected each cell using ctrl and entered the conditional formatting desired. However, it is working for every cell but one (it is being highlighted red when the cell is equal to 9.5%). I doubled checked in manager and the rule is correct, so I'm not sure why this is happening!

    Any help you can provide would be much appreciated.

    Thank you!

    • Hi Nicole,

      I would advise to double check 3 most obvious things:

      1. The rule applies to the correct range of cells (not including the column headers if any).

      2. If you created a rule with a formula, the formula is written for the left-most cell in the rage. For example, if you highlight rows 2 through 10, you should write the formula for row 2, e.g. $A2=9.5%

      3. Check the value in that stubborn cell. It may happen that the cell displays just 1 decimal place, while the real value in the cell is, for example, 9.51%. So, select that cell and view the actual value in the formula bar.

  247. rob says:

    I have been using a simple formula (=D3>C3) and its reverse (=D3<C3) to decide whether a cell is coloured red or green. The rule applies to all the cells in the column (=$D$3:$D$45). I have applied this rule to three columns in my spreadsheet, Columns C,D and E. The formula works fine in Columns C and D, but does not produce any formatting in E. In every way that I can assess, there is absolutely no difference in the cells in the E column than in the others. I have checked everything I can and I just cannot figure out why it will not work.
    Can you help me?

  248. Joni says:

    I am trying to create a spreadsheet using multiple numbers as status and I want the entire row to turn the correct color for that status. Example 1 new job want the color to be white, 2 contacted customer want the color to be pink 3 ordered parts want the color to be yellow, etc. to the final 6 green ready to invoice. I will have multiple columns in the row but I want the color to change based on the final column where I update status.

  249. Sergio says:

    Hi Svetlana, my job is to keep track of approaching oil changes needed. I have the (A)column with the Vehicle #s, the(B)column with the current mileage on the vehicles, and the (C)column with the mileage when the oil change is due. I've been trying to find a formula that I could use to automatically highlight the current mileage cells that are within 500 miles of the mileage when oil change is due (C).
    I would greatly appreciate your help.

    Thank you!

  250. Deepesh says:

    Is there any formula that will define the function of one cell depend upon the result of another cell. If the result of one cell is "Yes" then the formula in another cell will be executed accordingly, otherwise not.

    Can you help me?

    Thank you

  251. Nick says:


    I'm trying to highlight cells in one column where they differ from the corresponding cell in another column.

    So if E2C2, I want it highlighted, similarly if E3C3 etc. I've tried applying a rule to all of column E using the formula "=$E2$C2" (there are headers in row 1), but this produces random results. I've tried changing the fixed portion of the cell reference - E$2, $E$2, etc, but none of them works as expected.

    Can I do what I'm trying to do, or am I approaching it the wrong way?



    • Nick says:

      The comments function has swallowed the symbols. Originally this said "if E2 not equals C2" using chevrons, etc.

    • Hi Nick,

      I believe you meant =$E2<>$C2 (formulas often get messed up after posting, sorry for that).

      This is a correct formula and I can think of just one reason for it not working - a rule is applied to a wrong range. Please open the Rule Manager and check if it applies to the range beginning with cell E2.

  252. Nick says:

    Thanks Svetlana,

    Yes, that's exactly what I typed, before it got mangled :)

    Originally it applied to the whole column ($E:$E), but I changed it to E2:E1000. This made no difference.

    The E column is composed of values obtained by a vlookup() from another sheet. Will this mess things up?



    • Nick,

      In theory, this should make no difference, unless the numbers are formatted as text. Anyway, if you can send me your sample sheet (support@ablebits.com), we will try to figure that thing out. I am curious to know why it does not work on your data :)

    • Just an afterthought. Did you check the formula after changing the applied range? Excel sometimes changes the references as it thinks is appropriate, so please double check.

  253. rmi says:

    I have a list of different items (food menu) to cook, and on monthly basis I want to select from the list. but if I entered a manual item (that is not listed in the list) it should be a different colored text. I cant get result. I don't know how it could be.
    Please help

  254. Emoney says:

    Hi Svetlana,

    why does this return the correct cell number where the match is at, as to this
    =MATCH(TRIM($Q2),A2:A350,0) or =MATCH(TRIM($Q4),$A$2:$A$350,0)

    when using either of the above it makes the cell value off by 1. i.e. the actual cell where value is at: 3 but returns: 2

    thanks so much

    great stuff!!


  255. Brad Sanok says:

    Hello Svetlana,

    I am creating a workbook to track and rank various statistics for my office's summer golf league. I am running into a handful of formatting snags.

    Some of the stuff that I want to do is a bit more complex than I anticipated but I know it can be done in Excel. My hope is that the workbook can very automated with regards to data input.

    Please contact me if you are still available......I see the last post was from almost 1 year ago.

    Thank you so much for your time.

    Brad Sanok

  256. Julia says:

    I'm working on a sheet. In my G Column I have whether the task is "Resolved" Or not.
    The two options are either yes, or no.
    Columns A-F is the corresponding information for that task. Each row is a different task.
    I can get Column G to go green for yes and red for no, but I can't get the corresponding information in rows A-F go green or red for the corresponding Yes/No in Column G. What is the formula I should be using here?

    Thank you for your help!!

    • Hi Julia,

      You use the same formulas as you used to highlight column G but apply the rule to columns A-F, e.g. A2:F100. Given that row 2 is your first row with data, not including the column headers.

  257. satish says:

    Hi Svetlana,

    First thanks for clear and more useful data u explained me to learn from this site.
    Please clear this my problem if you can.

    In Jan'08 month I spend $2000 for on marketing and I earned $200 each month till jan'2010.

    And I continue spending more every month till 2015.

    Now I want to highlight the month where my spend reached break even or my budget.

    For example: my spend $2000 reached in Aug'09 month.

    Please let me know if you understand my problem.

    Thanks & Regards

  258. Jaclynn Sitterle says:


    I am hoping you can help me with a question I have in regards to conditional formatting a cell.

    I am try to conditional format cell D3 so that it is green if it is more than 50%>B3*20, red if it is <B3*20, and yellow in between.

    Is this possible?


  259. Harish says:

    Hi... I have to perform conditional formatting on a particular column, which should display the numbers entered into it, in 3 decimal format.

    My Condition is such that, a cell say example : E5, has some product name "ABCD", based on this text, column of say for example 50cells, has to display the data entered into it in decimal format, for example : 5 decimal places....If the product name differs, the decimal format has to change as per the product.. Product is an electronic product, each product provides output in decimal format of different decimal places(5, 4, 3, 2, etc,.).

  260. Claire says:

    Dear Svetlana

    Looking at all of these posts you certainly do know your stuff!

    I need to use duplicate conditional formatting to identify duplicates within a single column, however, I want this to apply to certain cells within the column, so E1-E3, then to start again at E4-E11 etc. I have ~1500 rows of data. The range of cells I want it to perform this on is dependent upon values in another column, which always start at 1 and increase in ones i.e.1,2,3 etc. I want the conditional formatting to start again every time it comes across a 1 for the second time within the other column:

    Presentation Chosen box
    1 4
    2 10
    1 4
    2 6
    3 8

    Here, Excel should not highlight the two cells containing '4', as these are within separate ranges (range 1: 1,2; range 2: 1,2,3). I only want it to identify duplicates within the range of cells depending on the values in column 'presentation'.

    I am not sure if this can be done. I have searched for a few hours and read various posts but it is looking bleak.

    Many thanks in advance, Claire

  261. Vladimir H. says:

    Hi Svetlana,

    I have a table with some name positions and values for them in 3 currencyes ($, Euro, GPB)
    Have already made a function that whenever I select one of the currency to bring the value just for the respective currency that I have selected. The problem is that it will bring just the value.

    Is there any format function that when I select the currency type to format the cell in (either $, E, or GPB - what I selected), so that it will not birng only the value that I need, but to be formated and contain the currency?

    Many thanks

    • Hi Vladimir,

      It's difficult to advise anything without seeing your formula. In most cases, you can use the concatenation operator, like this:

      =IF(A1="$", B1&"$", "")


      =IF(A1="$", B1&A1, "")

  262. Lance says:

    I have a question.

    I have this formula.
    (ROUND(MROUND((RAND()*(99-75)+75), (100/34)),0) which correctly returns a random value between 75 and 100. However, I want it to return a value that does not equal 100. I am a bit stuck on this one. So for example, it will return a whole number but it will round the value up to 100 on some trials. That is not good. How can I reconfigure this forumla to react properly? Thanks.

  263. Lance says:

    I forgot to mention that the number 34 is the raw value I am using as a divisor. This value can change. For example it can be a 12 or 15 or whatever number.

  264. Niroshan says:

    I just need to get an formula if week cover is higher than 3 how I can block the cell in CTN,so that others cant input anything in that cell.

    Dept Article UPC Description Pac WHS CTN IN CTN IN SINGLES STR STK Incl Tst Avg Sale Week Cover
    F02 20001578 62886 CRINKLE CUT CHIPS 12 600 50.00 0 31 31 4.15 7.46
    F02 20002307 343121 CHUNKY COD FISH FINGERS 12 2076 173.00 0 28 28 5.76 4.87
    F02 20002345 323796 STRAIGHT CUT CHIPS 12 1128 94.00 0 8 8 3.03 2.64

  265. Ashley says:

    Hi, I have a question.
    I have an excel spreadsheet that I am trying to compare pricing on.
    So I have all the information of the vendor, product description, etc. In column L I have the price that the vendor charged us for that product. Each product description has a different contract price. However, the vendor does not always charge us the correct contract price. Is there anyway to apply this type of conditional formatting to a spreadsheet like this? Below is close to what my columns show.

    Invoice # Number/SUPC Item Desc Purchase(cs) Vendor Price
    5011210 157048861 PIE 2 cases $49.38

    So the vendor charged us $49.38 per case, but we should have only been charged $49.11 per case.

    Does this make sense as to what I am asking? I am having to go through this manually over 10,000 line items. Every lime item could be different though. I know excel has the tools and technique to help me with this, I am just not sure what formula to use.

    Any help or suggestions would be greatly appreciated!

  266. Sarah says:

    Hi, I am referencing cells in a data entry worksheet to create coordinating filled cells in a separate sheet. However, when I use Format Painter to copy the conditional formats I created into 6 additional cells, and then edit the cell references to the coordinating cells in the data entry sheet, it changes all the cell references in all the "painted" formats. Is there a way to turn this off, or do I just have to write each conditional format independently?

    Thanks for your help!

  267. vipin says:

    I have a Excel sheet where attendance of various students are marked.Now I would like to highlight the cells in which "present" occurs more than 7 times consecutively (i.e a student is present continuously for 7 days excluding sundays) for each student...?

  268. SHINY says:


    i want to highlight values in a column based on the following condition:-

    column to highlight is AC which has % figures in few rows.

    CONDITION -if the dates in the cells range(J8:O8>8TH MAY'15)THEN HIGHLIGHT THE %VALUES IN COLUMN AC. rows

    kindly suggest solution.

  269. Saurabh says:

    I have a rule
    =IF(OR(DH1=8471702000,DH1=8471609000,DH1=9013901000,DH1=9031499090, DH1=8544422900,DH1=8541409000,DH1=8205400000,DH1=8504401990, DH1=8471703090,DH1=8443321200,DH1=9030311000),AND(BR1="CN", DD1="EXCH NEW"))
    If it find these numbers in DH column and same for BR and DD column than it will color a column green,
    Now i want to change the rule like color my required column if BR is "CN" and DD is "EXCH NEW" but only where there these no. are not coming in Column DH,
    Means same formula just to ignore these no.
    I tried in place of = but it does not work. It work if we right as a formula in cell but if i tried to add as a new rule in conditional formatting for color than it does not work.
    Can you provide me any help or suggestion on this.

  270. Catherine says:

    I'm using the "between" rule to color code some thickness data, but it is not being inclusive like it should. If the value is exactly the value of one of the bounds, then the cell stays white. I can fix it by having the values range to the value I want plus 0.001, but this is annoying and will take awhile to fix for all twenty tabs of data. Any ideas?

  271. Marty says:

    Hello-- Using Excel 2007---2 questions--

    1st --I have a column of cells (column B) containing text and two digit numbers in the same cell. I want the column next to it (column A) to have a conditional format based on whether that 2nd column has a number within a specific range. Meaning if it has a number between 10 and 19 the first column will be green, if between 20 and 29 it will be red, if it has a value between 30 and 40 it is a blue.

    2nd--Is it is possible to have is rule skip a number if it is followed by the word "egg" and only read the 2nd number for the conditional formatting rule?

    Here are some examples of the text and number in the second column.

    3 Split 15 Blast-(Column A Should be Green)
    4 Right 16 Blast-(Column A Should be Green)
    5 Split 23 Egg 16 Dive-(Column A Should be Green)
    6 Split 38 Egg Fly 23 Dive-(Column A Should be Red)
    7 Split 22 Dive 37 Egg-(Column A Should be Red)
    8 Split 33 Dive 28 Egg-(Column A Should be Blue)
    9 Split 33 Egg 28 Around-(Column A Should be Red)
    10 Twins R 37 Egg Fly 24 Dive-(Column A Should be Red)
    11 Split 23 Egg 30-R Flat-(Column A Should be Blue)

    Is this possible

  272. Chris Hicks says:

    I am trying to conditional format formulas that contain an adjustment to the formula. For example We will have A1+A2. I want to identify formulas that have A1+A2+1000 or A1+A2*2 etc. Formulas that have a component of the formula that is not a reference to another cell.

    I already can conditional format cells containing formulas ve values. I just can't see formulas that are adjusted and not overwritten completely.

    Thank you for the help.

    • Alexander says:

      Helllo Chris,

      It is an interesting task. You need to add User Defined Function (UDF) to your workbook. Here is the code:

      Function GetFormula(rng As range) As String
      getFormula = rng.Formula
      End Function

      For more details how to insert and run VBA code in Excel, please see here:

      Then select all the cells with formulas that you want to check, e.g. from F2 till E20, and create a conditional formatting rule using the formula below:


      Where $B$3 is the cell with a sample formula that you want to search, e.g. =A1+A2.

      If you know for sure what “text” you are looking for, then replace this part of the formula RIGHT(GetFormula($B$3),LEN(GetFormula($B$3))-1) with the “text” you want to search, e. g.:


  273. chona says:

    I have this table, it show like this:

    Given no. USL LSL Measured value Deviation Out of Scope
    (GN) + - (MV) (GN - MV) (This I want to get the answer) /
    42 42.3 41.7 42.38 .38 .08 (to get this, must choose / which is more nearer, to the
    / Given no. the USL or / LSL

  274. Ed says:

    Hi Svetlana,
    I am trying to fill one cell based on the value of another previously given.
    The problem is shwon in the example, number from 01 to 20 will appear in the first 4 columns (C1-C4). I want to take these values and put them into a respective contiguous set of columns (C6-C26). Is it something feasible in excel?

    I have this situation:
    C01 C02 C03 C04 C05 C06 C07 C08 C09 C10 C11 C12 C13 C14 C15 C16 C17 C18 C19
    01 05 09 14 01 05 09 14
    02 07 11 12 02 07 11 12
    08 09 10 12 08 09 10 12
    04 05 13 14 04 05 13 14
    and so on
    Thanks and Regards,

  275. Jenny says:


    I received quotation from different supplier and I need to compare the received prices. Can you please advise how to use conditioning function for comparing prices from different supplier. I want to get all best lowest prices in Green and highest price in Red.

  276. Jeetesh says:


    I have data's in 1st four column on the excel sheet. In those four columns i have common / similar data in column A and C. Column B and D consists of values which has to be reconcilied by matching the datas of A and C. For example
    Example 1
    Column A = 1
    Column C = 1
    Column B = 0.002
    Column D = 0.002

    The column E should show it is matching.

    Exapmle 2

    Column A = 1
    Column C = 1
    Column B = 0.02
    Column D = 0.002

    The column E should show it is not matching.

    The main constraint over here is we can have datas in column A is missing in Column C.on those scenario it should show as NA in column E.

    Kindly help me at the earliest.

    Thanks is advance.
    Jeetesh Jain.

  277. Ben says:

    Hey, guys.

    I would like to conditionally format cells which are contained in a formula.

    Ex: If A11 equals the Sum of A1:A10, I would like A1 through A10 highlighted a certain color.

    This would allow me to quickly see what cells are in the summation without putting the cursor in the formula bar up top.


  278. Luis says:

    Im doing a data bar formatting for a cell, and I would like the color of the data bar to change relative to the value of another cell.

    • Hi Luis,

      Select the cells where you want data bars to appear, click Conditional formatting > Data bars > More rules. In the "New Formatting Rule" window, select Formula in the "Type" box and enter your formula in the "Value" box. Just keep in mind that relative cell references are not allowed in Data bar formulas.

  279. Tom says:

    I'm having a problem with changing a cell colour based on multiple cell values.


    Column A has 3 values using a data validation list "requested, booked and delivered"

    Column B has the date of request.

    I would like the cell in column B to change colour if Column a value is "requested" and if date in column B is over 14 days old.

    Any help would be really appreciated

  280. Hi Tom,

    Assuming that row 2 is your first row with data, select all the cells in column B you want to color beginning with cell B2 and create a rule with the following formula:


  281. Carlos Fulgencio says:

    Hi Svetlana,

    First of all Congratulations for your blog! I find it 'state of the art' and a precious on-line resource. Of course I will spread the word about it...!

    As I wasn't able to find a solution that works among the tutorials and examples you posted above, please allow to present my question:

    How to apply conditional formatting to columns F, G, H and I (by instance change font colour to 'red'...) when it met a given criteria (comprised of the word string IMP) in the same line in column A (in Microsoft Excel 2007)...? Or in another way, which formula to use...?

    I deeply appreciate your help. Thank you.

    Kind regards,


    • Hello Carlos,

      Thank you very much for your kind words.

      You can select the entire columns $F:$I and create a rule with the following formula:

      The above formula works for the exact match. In case you are looking for a partial match formula, i.e. highlight columns F:I if column A contains values like "IMP 2" or "xIMP", then use the SEARCH function as follows:
      =SEARCH("IMP", $A1)>0

  282. Jon says:

    Hey there,

    I'm trying to set a conditional format where I want to change the colour of column A if the column width does not equal "10.29".

    Would you be able to help out?



    • Matthew says:

      Hey Jon,

      I have been trying to attempt the same thing with cell formulas. I have put in =cell("WIDTH") but it does not show the exact amount. Let me know if you have any luck with finding a formula.


  283. Shipra says:


    I have been trying to do cell formatting for following condition:


    I want to highlight the cells of column Q3 if the value doesn't match with values in column AS.
    I used above mentioned condition but somehow it's highlighting all the rows and columns from Q until AS. I tried to select following ranges "Q3:Q100" as well as "Q3:AS3, Q100:AS100", but no use.

    Please suggest.


    • Hi Shipra,

      I have just created a rule for Q3:Q100 with the following formula and it highlighted only cells in column Q that are not equal to values in column AS in the same row:

      Please double check the applied range via Conditional Formatting > Manage Rules.

  284. Edy says:

    Hi there,

    I got set of data and I need to color the cell based on value row before it.

    A B C D
    a 2 1 3 4
    b 3 0 4 5
    c 1 3 5 7
    d 8 9 3 3

    I need to color the Ab red (>Aa) and Bb green (<Ba). I want to apply the rules to all row and column. Is there anyway i can do it?

  285. Theo says:


    Great forum, hopefully what i'm trying to do is possible. Is it possible to inherit the color from referenced cells. For example, if I had a formula: =concatenate("This is a test ",B2). I need to inherit the existing value and color in cell B2.

  286. SWAP says:


    i am working on shift roster excel and i want to highlight only shift person name cell who is today.
    row A1 has Date
    column A2 has shift person name
    and B2-z2 has shift name(Day,Night)

    formula has to first check today's date then search in that column the shift name(day,night) if match Day the highlight the shift person name which is in column A2.

  287. shmuel says:

    I want to count payments: 1 of 30, 2 of 30 by writing 1/30, 2/30 and so on. I want to write two cells and drag to create the rest (as I do with dates or numgers).
    Can you suggest a way to do this? Thank you in advance

  288. Matt says:


    If anyone can suggest a reason for the following problem i'd be grateful.

    I am using conditional formatting to colour code times and distances for track and field according to a set of standards.

    For example I have formatted columns A, B, C, D so that

    2.5 to 3 are red
    3.1 to 4.49 are yellow
    4.5 and greater are green.

    I want to format other columns to use the same colour system but for different parameters as they are to represent different events.

    I have tried copy and paste as well as format painter to save time and then edit the rules only, removing the need to select the formatting each time.

    However, when I highlight a selection and edit the rule (checking that current selection is correct) it applies the rule change to the entire sheet!!

    Why does this happen?



  289. Shawn says:

    Does anyone know how to make a conditional format to create a specific number based on another cells number?
    Cell 1 shows the number 3
    I need cell 2 to then show the number 1.

    All in increments of 3, if it shows 6 then it will show 2.
    9 = 3
    12 = 4 etc. Also, If it is between 3 and 5 it will still show a 1, between 6 and 8 it will still show a 2 and so on.
    Any help would on this conditional formatting would be appreciated.

    • Tammy says:

      Hi Shawn,
      I believe a Lookup Formula would be your best option.

      If you have your data starting in cell A2, you can add the following formula in cell B2:

      =LOOKUP(lookup_value, lookup_vector, [result_vector])

      You can keep expanding the formula by increments of 3, but make sure you update the lookup_vector and result_vector.

      I hope this helps.

  290. Joey says:

    So I have this data on a summary sheet:

    #INT1 #INT1 #INT2 #INT2 #INT3 #INT3
    $FIL-B Y $FIL-H Y $FIL-B Y

    And so on…

    I was wondering if there was a way I could check row A and B against all other rows for pairs of data like $DAT and Y would be what to check for so $DAT and Y would be highlighted in A,B and E, F and the whole sheet.

    Any help would be greatly appreciated. Thank you. I can send a sample spreadsheet if you need.

  291. Ivan says:

    Hi guys, can someone help me please..

    How To use conditional formatting for example... in cell A1 Sheet 1, based on the value from cell A2 in Sheet 2.

    If Cell A2 (Sheet2) = "DA"....then Cell A1 (Sheet1) background is RED.

    Thank You

  292. Dane Atlas says:

    I have several series of data validation dropdowns, and lets say when E5 = text_value i want G5 to be highlighted

    because under specific conditions (depending on what previous choices are made) there needs to be an additional dropdown. i am not concerned with making a conditional data validation (probably not possible anyway) but i was hoping someone could help so that i could just highlight it so it sticks out when additional information is required

    • Dane Atlas says:

      nevermind!! i got it! after reading other situations i realized that the rule would be specific to the selected cell and wouldnt necessarily be a general formula for the entire sheet

  293. Suva says:

    Hi Svetlana!

    I'm copying exact version of your formula: =AND($B2>5, $B20 but when using "AND" function and trying to make multiple criterias it just keep giving error.


  294. Garry says:

    Hi Svetlana.
    I have a conditional format running that changes a cell blue if the letters GI are entered or red if the letters AFM are entered, I also need the cell to the left of GI or AFM cell to format blue or red. I have tried many formulas but without any luck

  295. Randy says:

    Is there a way to conditionally format cells to match the fill color of an original cell with matching text that was manually color filled?

  296. Thushan says:

    Hi svetlana,
    Is there a way to colour a cell with two colours depending on a values cells in other work sheet?

    ex: sheet 1 cell A1 to be colored with red, if value in sheet 2 cell A1>0 and also sheet 1 cell A1 to be colored with green, if value in sheet 2 cell B1>0

    • Hi Thushan,

      Of course, it's possible. In conditional formatting formulas you can refer to other sheets just as you would normally do. For example, you can create 2 different rules for A1 in sheet 1:

      Red: =Sheet2!$A1>0
      Green: =Sheet2!$B1>0

  297. caren says:

    I have the traffic light icon working in the cell that has the value, however I want the value to be in one cell the the traffic light to be in the next cell. Is that possible?

    • Hello Caren,

      Because it is not possible to use relative references in conditional formatting criteria for icon sets, you cannot apply icons based on another cell's value.

      As a workaround, you can copy the values to the next column, say by entering a simple formula like =$A1 in cell B1 and then copying it down to other cells in column B. Then you apply icons to column B and select the "Show Icon Only" option. So, visually you will have values in column A and corresponding icons will display in column B.

  298. Mahmood says:

    i have a small dilemma and would appreciate if anyone could help out.

    So i have the following arrangement

    J M K S
    3 2 3 5 k ?
    76 5 75 7 k ?
    4 564 76 53 j ?
    354 34 456 24 s ?

    Were I would like the letters column to be matched to the letters row, and the question marks replaced by the corresponding value under the letters row.
    resulting for example in the following
    k 3
    k 76
    j 4
    s 24

    does anyone know what equation I need to use to substitute the values instead of the question marks?

    Thank you

  299. Mahmood says:

    J M K S
    3 2 3 5---------k--?
    76 5 75 7---------k--?
    4 564 76 53--------j--?
    354 34 456 24--------s--?

  300. Rachel says:

    I wondered if you could help me please. I am trying to create a month by month summary of our customer service scores. All i would like to do is to highlight the cell green or red based on whether the score has increased or decreased from the previous month. For exmaple:
    Month Overall
    Oct-14 -100
    Nov-14 18
    Dec-14 -50
    Jan-15 -8
    Feb-15 45
    Mar-15 -2
    Apr-15 30
    May-15 20

    So i would like May's score to be highlighted red because it decreased from April. But April to be highlighted green because it increased from march.


  301. Georgina says:

    Hello! Thanks for the info above.

    Please can you help... I am looking for cell A to look at cell B and for cell A to change colour if the value is...
    Green - less than 10 of the value of B
    Amber - less than 5 of the value of B
    Red - equal to or greater than the value of B.

    The problem being that both B and A will change with data input and B. Hope that makes sense! Thanks in advance for your help.

  302. Gafoor says:

    I needed conditional formatting for an excel sheet with growth chart. In this i wanna know which have growth and which have de-growth based on last year sales

  303. Lakshmy says:

    Thank you so much :)

  304. Danielle says:

    I've been working on a sales target spreadsheet that has normal formulas & then also using conditional formatting.

    In one part of the spreadsheet we are calculating the variance between 2 cells, ie E14-F14 this formula is in cell G14 (figures are 4-4=0). My conditional formatting for all the cells is
    =AND(COUNT(B6),B6>=0) set so if the variance is positive the cell will be green
    =AND(COUNT(B6),B6<0) set so if the variance is negative the cell will be red

    now this conditional formatting making cell G14 red, when we want it to be green. This happening for the cells in column G that have the same formula.
    However in all the other columns D, J, M etc if the cell is 1-1=0 the cell will be colored green.

    I have removed all the conditional formatting from the excel and inputted again & this hasn't fixed it. I'm not sure what to do next to try & fix this.

    I hope this all makes sense & look forward to a response!

  305. Johnny says:

    Great article but can't find exactly what I'm looking for.

    I want to make a formula that will look at a whole column, say the B column, in one sheet and see if there are any "No" entries. If there are ANY "No" entries, I want it to change the colour of a cell, say the A1 cell, in another sheet.

    I have a crude formula here, using a "TRUE" statement instead of colouring the cell and also giving the range 1-9999 which is ugly: =ISNUMBER(SEARCH("No",Sheet2!B1:B9999))=TRUE

    I hope this makes sense and would be really grateful of any response!

  306. Manzoor says:

    I want to highlight cell which has specified value. Like if there are 1 to 10 nos. i want to highlight only 3, 2, 7. which formula do i use. Please help

  307. kawal says:

    I want to put a statement in excel and want to add a specific value reference in between the statement as "today total sale is .........( reference of cell B15) and purchase is ....( REference of cell C51). is it possible if yes how????

    • Hi Kawal,

      You don't need the conditional formatting for this task. You can use the CONCATENATE function or the & operator as follows:
      ="today total sale is "&B15
      =CONCATENATE("purchase is ", C51)

  308. Marius says:

    Hello Svetlana,

    I have 2 columns, first (G) with the Status, validated list, Red, Amber, Green, Closed. On the second column (H), I have % of completion. On H I need to used Data Bars, but the colour needs to be the one described in G column. For Closed will be blue. Can you help me do it?

    Thank you,

  309. Laurie says:

    Hi Svetlana, Firstly well done on an excellent page and very helpful explanations. I recently came across an auditing spreadsheet where you had questions to answer and the option to select a colour/text from a drop down menu on each scoring cell, in this case Blue, Green Yellow and Red. The spreadsheet then added the number of e.g. RED cells and produced a score. I have not been able to determine how they did this because the spreadsheet was protected. If I have asked the question clearly enough, can you guide me please?

  310. Helen says:

    Thank you for a fantastic resource, I'm an inexperienced Excel user but your tutorials have really developed my skills. However, I'm struggling with conditional formatting.

    I have a worksheet which calculates gross margins. I'd like to be able to highlight rows where the margin falls below a set level. However the cells that hold the margin contain a formula (=IF(F2=0, "", F2-M2/F2) rather than a value. It is the result of this formula that is the margin.

    Please could you advise how I can make the formatting conditional on the result of the formula?

    • Hi Helen,

      I'm glad to know our tutorials have proved helpful. In conditional formatting, it does not really matter if a cell contains a value typed manually or returned by some formula. So, you can create a rule based on a simple formula similar to this:

      Where C2 is the cell with your margin formula and 10 is a "set level".

      • Helen says:

        Hi, thanks for the speedy reply. I wondered if that was the case but I've not had any success.

        If I set it to =$N2<50 it highlights every row except those that are blank regardless of the value returned. This is why I thought that maybe it was different for formulas.

        • Helen,

          It's very strange because the rule worked perfectly on my test sheet. Please make sure it applies to a range beginning in row 2, for example A2:N100.

          If the problem persists, you can send a sample workbook to our support team (support@ablebits.com) and we will try to figure it out.

          • Helen,

            I'm posting the formula here just in case my message does not reach you for some reason. Because the Gross Profit column displays percentages, the conditional rule formula should be written for percentage as well. Once you change it to =$N2<50%, the rule will work perfectly.

  311. VASU says:

    Thanks a lot to you and Google aswell

  312. Enzo says:

    Dear Svetlana,
    first of all let me congratulate you for this excellent blog.

    And now to my question:
    My worksheet is composed of 26 columns and 81 rows.
    Column A contains a list of items and column B their price; column Y the total number of items in stock and column Z the number of items to be put on sale.
    Row 1 is a heading.

    Cells C2:V2 contain numbers 1 to 20. Cells C3:V81 are empty and should be conditionally formatted, based on the following criteria:

    if the number above each cell (C2:V2) is less or equal to the corresponding value of cell Z of the cell's row then that cell must receive a border. Of course, the formatting should change when the value in column Z changes.

    I have already tried different methods that seem to work, at least partially (e.g. a formula such as =C$2<=$Z3). The problem is that when te values in Z decrease the borders don't disappear; instead the (now) empty cells keep a double-line vertical border. What am I doing wrong? Is it possible to end with a "clean" sheet without going for a macro?

    I hope you can answer me and in the meantime I thank you very much.

  313. Helen says:

    This site is great! I read through many of the comments and couldn't find anything like this, but it may have already been discussed. I have a column with cities and an adjacent column with states. There are different cities with the same name in several states- Springfield, for example. I want to highlight Springfield, MO in one color and Springfield, IL a different color. Can I create a conditional format that will say: when Cell Q="Springfield" and Cell R="MO", Cell Q should be green. Then if Cell Q = "Springfield" and Cell R= "IL", Cell Q should be blue. Thank you for your assistance!

    • Hi Helen,

      Of course, you can create such a rule, e.g.
      Green: =AND($Q2="Springfield", $R2="MO")

      You can even list several cities in the first condition so that you won't have to create a separate rule for each city, e.g.

      Green: =AND(OR($Q2="Springfield", $Q2="city2", $Q2="city3"), $R2="MO")

      • Helen says:

        This is pretty close to the formula I was already using and I couldn't figure out why it wasn't working! I played around with it a little and after I changed from $Q2 and $R2 to $Q1 and $R1, it worked! Thank you for your help.

  314. Ali G says:

    Hi There:
    I'm working on this project that I use the conditional formatting to change the color of the cell that is doing the calculations. Unfortunately they have changed the requirements and they want me to add another cell that will change its color when the other two cells change there's. for instance if Column A turns red and column B turn green then column C has to turn red. If A and B are both green then C will turn green(if one of the A or B is red then C will always be Red). When the column C turns red it has to display Fail and when Column C is green it has to display Pass. Can we make this in excel? Any feedback will be deeply appreciated.

  315. Enzo says:

    Hi Svetlana.

    I managed to SOLVE my problem.
    The trick was to format the cells with a partial border, i.e. leaving the left side blank. Now everything is fine and working.

    I wish you all the best.

  316. JD says:

    Having a prob with conditional format. I tried using the following formula:
    If it is true then turn the cell to yellow.
    #1 It is not turning that cell to yellow.
    #2 If I copy the conditional formula to a cell on the SS to verify it shows as true so it is valid.
    #3 After I get the correct formula how is it applied to a column because right now it always wants to reference the same line.


  317. John says:

    Hi. I am struggling with trying to resolve the icon sets when the data is Zero. I string 7 months of data to compare month to month. I am using the reverse icon when we have a drop in a bad measure. Normally, there is a numerator and denominator. However, on the months where we have consecutive Zero numerators, the icons do not show and only show "0" which I cannot resolve to just be a neutral (no change/yellow arrow). Any suggestions?

  318. Martin says:

    Using conditional formatting to highlight calender dates.
    Currently if I receive a document on the 1st July, I have to contractually respond within 10 working days. I am using an Icon set to say Green when plenty of time changing to red 3 days before I have to reply.
    My problem is once I reply (the date is recorded in another column) I want the Traffic lights to disappear complete. HOW can I do this????

  319. Jasmine says:


    I have read through all of the questions on this page and didn’t see this specific question asked. I would greatly appreciate your assistance!

    I have an excel worksheet- starting in column and row D6 (start date), E6 (End date), and F6 (Frequency). Across the rows at the top we have weeks starting in column and row G4, H4, I4, etc = (July 13, July 20, July 27), etc.

    My first conditional format- to color in the weeks where a communication was sent, worked. That formula was: =AND(G$4$D6) and it applied to: =$G$6:$AM$38

    This worked well for the rows with the frequency of daily or weekly. Where we are struggling with is conditionally formatting rows to fill cells with monthly repetition.

    Currently, the formula I have: =AND(G$4$D7) is for a specific row i.e. applies to: =$G$7:$AN$7 and this highlights the specific cell that corresponds to the week of the first date that the communication was sent out.

    My first question:

    1) How do I create a specific conditional formatting rule using the =AND(G$4$D7) formula that fills in a cell every 30 days or 1 month and also corresponds to the correct week, leaves the remainder of the cells blank for that row, and that also ends when the end date in column E says? Will I have to have 2 separate formulas for each row with a monthly frequency? One for filling in the cells, the other for shading the remainder blank? Also, I should be able to specify in one rule that the formula applies to row 7, 10, 15, 22 for example in the “Applies to” section without having to make a new rule for each row, correct?
    2) What is the order in the rules manager that these rules should be placed? Should the original formula for all cells be placed at the top or bottom?

    Thank you in advance for the help.

  320. chandru says:

    How to use text formula in conditional format

    on the above date i want to highlight saturday and sunday by using text(a2,"dddd") with conditional foramt, pls helm me.

    Thank in advance
    Chandra shekhar

Post a comment

Unfortunately, due to the volume of comments received we cannot guarantee that we will be able to give you a timely response. When posting a question, please be very clear and concise. We thank you for understanding!
Ultimate Suite for Excel Professionals
Incredible product, even better tech support…AbleBits totally delivers!
Deborah Bryant
Anyone who works with Excel is sure to find their work made easier
Jackie Lee
The best spent money on software I've ever spent!
Patrick Raugh
Ablebits is a fantastic product - easy to use and so efficient.
Debra Celmer
Excel is at its best now
Annie C.
I don't know how to thank you enough for your Excel add-ins
Jennifer Morningstar
Anybody who experiences it, is bound to love it!
Kumar Nepa
AbleBits suite has really helped me when I was in a crunch!
Nelda Fink
I have enjoyed every bit of it and time am using it
Christian Onyekachi Nwosu
It's the best $100 we've ever spent!
Mike Cavanagh
I love the program, and I can't imagine using Excel without it!
Robert Madsen
One word… WOW!
Dave Brown
Love the products!
David Johnston
It is like having an expert at my shoulder helping me…
Linda Shakespeare
Your software really helps make my job easier
Jeannie C.
Thanks for a terrific product that is worth every single cent!
Dianne Young
I love your product
Brad Gibson
Sheila Blanchard