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

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

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!

189 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

  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.

  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 : )

  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.


  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:
      =AND($B1<>"",$B1< $A1)

      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!

Post a comment

Ultimate Suite for Excel Professionals
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
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