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.

- How to create a conditional formatting rule with a formula
- Examples of Excel conditional formatting formulas
- How to fix Excel conditional formatting not working

## 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...**

**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.

**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.

**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.

## 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 (Greater than, Less than, Equal to)
- Compare values based on several conditions (OR and AND formulas)
- Formulas for blanks and non-blanks
- Formulas for text values
- Formulas to highlight duplicates
- Format values above or below average
- Highlight the nearest value in the data set

### 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.

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.

### 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**.

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**.

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:

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 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 1^{st} 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 : )

#### Highlight duplicates without 1^{st} occurrences

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

#### 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 2^{nd}occurrence and all subsequent occurrences, if any.Rule 2 (green):`=$A2=$A3`

- highlights the 1^{st}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 2^{nd} and all subsequent duplicate occurrences, should be the first rule in the list, especially if you are using two different colors.

#### 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 1^{st} occurrences). Naturally, you can hide an additional column after creating the rule.

#### 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.

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

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

`=MIN(ABS(B2:D13-(0)))`

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:

`=OR(B3=0-$C$2,B3=0+$C$2)`

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

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

`=MIN(ABS(B3:C13-(0))+(10^0*(B3:C13=0)))`

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:

`=OR(B3=0-$C$2,B3=0+$C$2)`

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.

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:

- How to change the row color based on a cell's value
- Excel conditional formatting for dates
- Alternate row and column colors in Excel
- Two ways to change background color based on cell value
- Count and sum cells by color in Excel 2010 and 2013
- Conditional formatting in Excel PivotTables

## 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!

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

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.

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:

=$C2><""

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:

=countif($A2:$G2,"><"&"")>0

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

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.

Hi,

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..

scenario-

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:

=concatenate(A2,B2)

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:

=countif($C$2:$C2,$C2)>1

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.

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

(A,b,c)

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....

Hi svetlana,

Can you please provide an update on above question..

Thanks,

Hitesh

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.?

Thanks

Hi Derek,

You were almost there : ) You need to create a

separate rulefor 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

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.

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.

Hi Naveen,

I'm sorry, I do not have any idea on how to do this. I'm not even sure this is possible in principle.

=OR($E2="Yes")

Hi,

I have an answer for this if you can explain in brief..

Thanks,

Hitesh

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:

=COUNTIF($A2:$H2,"="&A2)=1

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.

Thank you! The second suggestion worked!

Hello,

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.

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?

nevermind. i think i figured it out. you can delete my thread.

Hello,

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.

Thanks

Rutger

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

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!

John

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.

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.

Yours

John

Hi John,

Got it, please try this one:

=COUNTIF($A3:A3,A3)=2

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.

Wonderful Svetlana,

You are a genius and a true excel fairy. Many thanks indeed.

John

Hello,

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".

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?

You just need to use an absolute column and a relative row in your formulas. Please try these ones (assuming that row 2 is your first row with data):

=$C2>$D2

=$C2<$D2

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

Svetlana,

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!

Jen

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.

Thanks!

Hi Steve,

You can use a user-defined function to count color-codes cells, we provide the ready-to-use code in this article - How to count and sums cells by color in Excel. You will need only the GetCellColor function that returns the background color code of the specified cells. You can use this function within your IF formula like this: =IF(GetCellColor(F319)=GetCellColor(F320), "","{RULE}").

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.

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.

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.

Thanks!

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.

Svetlana,

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 !

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?

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

Hi Jared,

As I see in the comments timestamps, it took you just 16 min to figure out the solution. So, you definitely are not : )

Hi,

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?

Thanks!

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.

Hello,

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.

Hello,

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.

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:

=AND(C2="open",K2>30)

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

Hello,

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?

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:

=AND((OR($F$3="Done");($F$3="N/A"));(OR($G$3="Done");($G$3="N/A"));(OR($H$3="Done");($H$3="N/A")))

If you find some time, can you guide me to the right solution please?

I found a working solution :)

=AND(OR($F3="Done";$F3="N/A");OR($G3="Done";$G3="N/A");OR($H3="Done";$H3="N/A"))

Excellent! Sorry for not being able to respond earlier, this is because we do not monitor comments on weekends :)

Hello,

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!

Thanks!

Sorry, Carl, this is my fault - there was a misprint in the address. Don't know how that could happen, I typed it hundreds of times... Here is the correct one (double checked : ) - support@ablebits.com

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

=if(mid(sheet!y6,11,5)='F316L','XXXXXXXX',YYYYYYY)

THIS IS WORKING OK WHEN THE DATA IS F316L BUT WHEN DATA IS ' 12 '

VSD

Reply

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.

DEAR SIR/MEM

WHEN I SELECT ROW AND COLUMN ITS NOW SHOWING IN NORMAL BLUE COLOR

..I WANT TOSAY THAT WHEN I DRAG A CELL ITS NOW SHOWING THAT I M SELECTING

HOW CAN I SOLVE IT PLZ REPLAY WITH ANS..

UR FAITH FULLY USER

CHANDRESH VAVADIYA

Hello CHANDRESH,

I am very sorry, but I do not understand your question. Anyway, I believe the issue does not relate to Excel conditional formatting.

Afternoon

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

Hi Alison,

You simply have to create 2 rules with different colors for column A:

Green: =$B2=”Approved”

Amber: =$B2=”Pending”

Did it work?

Hi

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.

OH THANK YOU Soooo much! First formula worked a treat.

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!

Hi Harrison,

I believe this can be done using Excel's VLOOKUP function or our Merge Tables add-in. If I can have a look at your data, I think I will be able to suggest the right formula. So, feel free to send me your sample workbook at support@ablebits.com.

Hi

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

=ISFORMULA(A2)=FALSE

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:

=ISFORMULA(A2)=FALSE

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

Hi Lisa,

You are right, this is simple, and conditional formatting is not needed :)

Just enter the following formula into cell C5:

=IF(B5>100,"YES","NO")

Thank you so much! Now that makes sense! I have come across this before but must have completely forgot. Thanks again :)

Hi,

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:

=$F2<>Sheet2!$H2

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.

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.

Pri

Hi Pri,

I believe this is the formula you need - How to alternate row colors based on a value change.

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...

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

Pri

Sorry Pri, I don't know such a way :( I can only suggest hiding that additional column.

Hello,

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!

Hi Josh,

It looks like this can be done, but we need to see the structure of your data to be able to say with certainty and suggest a proper formula. If you send me your sample workbook at support@ablebits.com, we will try to help.

Hi,

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

Hello Eric,

You can do this using a VLOOKUP formula similar to this:

=VLOOKUP($A2,Sheet1!B2:C20,2)

Where A is the column with descriptions in your Sheet2, B is the column with descriptions in Sheet1, and C is the item codes column in Sheet1. Please note that the VLOOKUP function cannot search on its left, therefore the Descriptions column (in Sheet1) should the the left-most column in your lookup range.

Please see the following tutorial for more info:

Excel VLOOKUP tutorial for beginners - syntax and formula examples

Advanced VLOOKUP formula examples

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:

=COUNTIF($A$2:$A$20,A2)>5

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.

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

figured it out.

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

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

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), "")

Hello!

And what values do you have in other cells of column D and why do you compare with A1? If you can send us a sample workbook at support@ablebits.com, it would be much easier for us to suggest a proper formula.

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?

Hi

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

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:

=if(K2<>"","Programmed","")

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.

Hi

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.

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.

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

=MAX($B2:$E2)=B2

=MIN($B2:$E2)=B2

Hi,

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.

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"

Hello-

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.

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

Hello,

The picture is automatically pulled from gravatar.com (Globally Recognized Avatar).

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.

hi

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

Steve

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.

Brilliant! thank you; option 1 worked perfectly. Thank you so much.

Steve

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.

Hi Cathy,

Most likely, you need a special macro for this task. I am really sorry we can’t help you with this. Please look for a solution on these forums: http://www.mrexcel.com or http://www.excelforum.com

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.

Hello Geoff,

I think you can create a rule with this formula

=OR(len($G2)<10,len($G2)>10)

Where G2 is the first cell in your column, not including headers.

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.

Hi,

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.

Help?

Jeremy,

It is hard to say what can cause the problem without seeing your data. If possible, please send your workbook at support@ablebits.com and we will try to help.

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

Thank you!

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:

=COUNTIF($B2:$F2,"0")=5

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

THANK YOU! This was exactly what I wanted!

One other question for you. I applied this to the first row, but I have 100 students on this spreadsheet. How do I apply this to each row separately?

Thanks again!

Hi Alisa,

When creating a rule, just select all the rows to which the rule shall be applied. Then you write the formula for the first row, and Excel will automatically "recalculate" it for other rows.

You can change the existing rule by clicking Conditional Formatting > Manage Rules > "Applies to" field.

Thank you!

Hi

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:

=$A1=$B$1

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.

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

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'.

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'.

The comments in my post keep getting cut short and altered. Is there an email address I can send my list of rules I need to create formulas for?

Kevin,

Please email at alex@ablebits.com. If possible, please include a sample workbook with your data.

I will try to reply as soon as possible.

Svetlana,

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

1000-

2300-

2600-

2702-

2750-

4001-

4022-

6000-

6067-

6100-

6161-

6200-

6261-

6300-

7100-

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.

Thanks.

Hi Steven,

Try creating a rule for column B with this formula (assuming that row 2 is your first row with data):

=COUNTIF($A2:$A10000,$B2&"*")>0

For more info about using the COUNTIF function, please see this article:

http://www.ablebits.com/office-addins-blog/2014/07/02/excel-countif-examples/

That was exactly what I was looking for. Thank you so much. This will help so much.

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!!!!

Hello TJ

For us to be able to assist you better, please send your sample workbook to alex@ablebits.com.

Great just to confirm I have noumerous list like

A B

1 3

1

3 5

4

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

Hi Stratis,

You need absolute column references (since both columns are constant) and relative row references, like this:

If a cell in

column Ais not empty and if the cell in column B is greater than in column A:=AND($A1<>"",$B1>$A1)

If a cell in

column Bis not empty and if the cell in column B is greater than in column A:=AND($B1<>"",$B1>$A1)

You can lean more about proper use of absolute and relative cell references in conditional formatting rules in this tutorial:

http://www.ablebits.com/office-addins-blog/2014/08/07/relative-absolute-cell-references-excel-conditional-formatting/

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:

=5-COUNTBLANK($A1:$E1)=1

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:

=COUNTBLANK($A1:$E1)=4

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.

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

Sir,

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

Hi Kiran,

You can try using a VLOOKUP formula, as explained in this tutorial:

http://www.ablebits.com/office-addins-blog/2014/07/17/excel-vlookup-tutorial-beginner/

Hi

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

Hi David,

You can find the detailed answers to your questions in my recent article: INDEX & MATCH in Excel - a better alternative to VLOOKUP

Hope you'll find it helpful.

Hi

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?

Thanks

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:

=COUNTIF($H$2:$H$100,$H2)>1

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.

Hi

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

etc.

Hi

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.

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?

Examples:

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.

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.

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

Mark

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

Hi Mark,

I am sorry, I don't know a way to fulfill this task using conditional formatting formulas.

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.

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.

Hi Bradley,

I am sorry, I can't make a proper formula without seeing your data. If possible, please send a sample workbook at support@ablebits.com and we'll try to help.

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.

--Sameer

Hello Sameer,

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

=AVERAGE(INDIRECT("A"&((ROW()-2)*10000+1)&":A"&(ROW()-1)*10000))

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.

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??

Hi!

You were almost there : )

=IF(A1>B1,"Increased by "&(A1-B1),"Decressed by "&(B1-A1))

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:

=$A1=$A2

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

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?

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..

Hi Adam,

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

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

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?

Hi Sherry and Crosbi,

Recently we've received several such questions and I thought we should add an example to the tutorial. Please check it out:

How to highlight consecutive duplicates in Excel

Hopefully this is the solution you are looking for.

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.

Hello Shawna,

Please have look at this article about using conditional formatting in PivotTables:

http://www.ablebits.com/office-addins-blog/2011/05/23/excel-conditional-formatting-pivottables/

If you need to highlight cells with the value greater than 20 and if the values of the three preceding cells are greater than 20 as well, then select all the data (they should be in the 4th row or below) and enter this formula:

=AND($B5>=20,$B4>=20,$B3>=20,$B2>=20)=true

Where B is the column with your data, B5 is the first cell with the data.

Hi,

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

Hello Arun,

I am sorry, I don't know the way to fulfill this task using conditional formatting, a special macro is needed for this.

Hi,

Thanks a lots for your reply

is there any reference for same?

if yes than kindly share with me

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

may i know how to do it

A B C

149 86 554

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

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

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

Thanks

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 "".

Thanks

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.

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?

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.

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?

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.

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!

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:

=SUM($F2:F2)<=$D$2

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:

=SUM($F2:F2)<=($D2+$E2)

Wonderful tutorial!! Thank you so much!!

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.

=$D13="DR"

Color Red for

=$E$13:$E$50

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

Glenn

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.

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

Thank you

Glenn

Hi Glenn,

Here is the formula for cell D1:

=IF(B1="Appreciated",C1,"")

Hi Svetlana,

THANK YOU very much

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

Helo,

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

Hello,

Good morning,I already figure it out last night.

Thank you very much

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!

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:

=A1>=LARGE($A1:$O1,3)

Perfect! :)

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

Hello Adam,

You can deduct actual expenses from the weekly budget, then divide by the number of remaining days and you'll get your budget for a day. If you send your sample workbook at support@ablebits.com, I believe we'll be able to write a proper formula.

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.

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:

=AND($A2=$B2,COUNTIF($C$2:$C2,$C2)>1)

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...

=COUNTIFS($B:$B,$B2,$E:$E,$E2,$J:$J,$J2)>1

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.

Thanks!

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.

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.

Thanks

Hello Jean,

I am sorry, it is not very clear how column 2 and $AJ4 are related. If you can send a sample workbook to support@ablebits.com, we will try to help.

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.

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!

Hello Susan,

Simply select all the columns and create a rule using this formula:

=countif($B:$B,$B2)>1

Perfect - thank you SO MUCH! Have a great day!

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

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:

=$G1="WD"

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?

Thanks!!

Hi!

Of course, you can have them all in one rule by using the OR formula like this:

=OR($G1="WD",$G1="TD",$G1="Exec Deed")

Svetlana,

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?

Thanks!

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.

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:

=IF($A1>=1,IF($A1<=50,1,""),"")

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.

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..

Regards

Shubham

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="")

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.

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.

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!!

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.

Ex.

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

Opportunity Analysis (OAS)

Name YRC

Vertical HC/MF/OTHER

OtherActual 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

71MFStop LightEst. Fee per location per month > 85

Proceed with caution 75 - 84

Stop - See VP of Sales < 75

HCStop LightEst. Fee per location per month > 125

Proceed with caution 115 - 124

Stop - See VP of Sales < 115

OtherStop LightEst. 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.

Monique

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.

Regards,

Ajay Verma

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.

Regards,

Ajay Verma

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

=4

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

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... :-(

Finally, I found it...

In the ticket table all the cells will have a colour formatting based on:

Formula is =COUNTIF(first_table;cell)

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,

Hilde

Hi Hilde,

Try modifying your formula a bit by removing the $ sign from B2, like this:

=ISNUMBER(MATCH("X";B2:$M2;0))

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.

Hello Debbie,

And what is the indication of a new customer?

Hello,

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:

=AND($C2>=TODAY()-30,$C2<=TODAY()+30,$D2="")

Assuming that row 2 is your first row with data.

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?

Hi Brian,

Try creating a rule with this formula:

=A2>AVERAGE(A2:A20)*1.5

Where A2 is your first cell with data.

Hello,

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

Svetlana,

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.

Thank you, Carlos.

Unfortunately, I don't know the way to fulfill your task using a formula or a VBA macro. Really sorry.

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.

Hello Jason,

Sorry, I don't exactly understand your task. Please describe in more detail what you want to get.

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.

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?

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"

Hello Musadiq,

This is very easy. Simply select cell B2 and create a rule with the formula =A1="yes"

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.

A really good post. Thanks.

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?

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

Hi,

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.

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!

Gary

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)

Hi,

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.

Cheers.

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.

Thanks

Shaun

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.

Hi

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.

Example:

Invoice # Dr Cr

111 14 0

111 0 12

111 0 2

222 4 0

222 0 3

would result in

SOMETHING

SOMETHING

SOMETHING

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!!

Hi,

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...

Hi,

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

=IF(B2="yes",Sheet2!B3,"")

=IF(B2="no",Sheet3!B3,"")

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?

Hello Alex,

I am sorry, it is difficult to recommend anything without seeing your data. If you can send your sample workbook to support@ablebits.com pointing out the column you want to add, our support team will try to help.

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 !

$D25490

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.

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.

Hi,

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?

This worked:

Select range B1:B5.

Conditional Formatting > New Rule.

>Format only cells that contain.

Cell Value > equal to > =IF($A$1=1,MAX($B$1:$B$5))

Format > Fill > Red.

Hello Andy,

Select the cells B1:B5 and create a rule using this formula:

=AND($A$1=1,Max($B$1:$B$5)=B5)

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?

Hi,

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!

HI,

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.

Thanks,

Ben

Hi Ben,

Please clarify what exactly result you want to get: expenses for 23-Nov-14 ($100), a sum for the previous days in November or something else?

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!

Hello Ahamed,

Of course, it is possible. One an AND function can be one of the conditions in the OR function and vice versa. For example:

=AND(B1=2,OR(C1=3,C1=4))

=OR(AND(B1=2,C1=3),C1=5)

HI,

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?

Thanks

Nazmul

Hi Nazmul,

If FALSE is entered in D1 as a logical value (Boolean), then you can create a rule for cell A1 (or multiple cells in column A) with the formula: =D1=false

If you have "false" as a usual text, then enclose it in double quotes in the formula:

=D1="false"

Hi Svetlana,

Thanks..it works.

I have another problem. I want to change a row color for a cell value of those row..How can I do that?

Nazmul

Hi Nazmul,

Simply select entire rows and create a conditional formatting rule using the same formula.

hi

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

i mean 2nd date added

Hello

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

12340

or1,2340

how do I write it

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.

Thanks!

Ian.

Sir,

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

Hi Ranganath,

Assuming that row 2 is your first row with date, here's the formula:

=K2<>D2

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

Hello,

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??

=AND(ISNUMBER(B2),ISNUMBER($A2),B2>$A2)

Where Cell A is the criteria and B is the result

Thanks,

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

1

1

1

2

3

3

3

3

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?

Thanks

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!

Ashley

...oops forgot to say, I wish to colour it when it says "Yes". "No" should be left unformatted

Hi Ashley,

You can combine these 2 conditions using the AND function, like this:

Red: =AND(TODAY()-$D2>60, $F2="yes")

Amber: =AND(TODAY()-$D2>30, $F2="yes")

Please note that the Red rule shall come first in the list of rules.

Great, that works a treat. Thank you for your timely help :)

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?

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:

=NOT(ISERR(SEARCH(Sheet2!$A1:$A3,A1)))

(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?

-Michael

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:

=MATCH(IFERROR(RIGHT(A1,LEN(A1)-FIND("@",A1)),""),Sheet2!$A$1:$A$3,0)>=1

You rock my world. Remind to me buy you a beer if we ever meet. :)

Hi..

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?

Hi Nazmul,

Simply select all the rows you want to highlight and create a rule with this formula:

=$D1="fail"

Hi Svetlana,

Thanks a lot..it works..

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.

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.

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.

I solved this problem with using VLookup

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

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

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

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

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

Hi,

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.

Thanks.

Hi,

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.

Thanks!

Hello,

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

Hello,

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

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

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

I WANT TO SATISFY THIS THREE CONDITIONS IN A SINGLE FORMULA, IS IT POSSIBLE?

PLS GUIDE ME

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?

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.

sorry, formatting went wrong, hope you can read it

for every space there should be a tab.

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

Nevermind! I Figured it out. It should have looked like this:

=AND($F3>=0, $G3<($F3*0.9))

I am such a noob :P

Hi,

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

ON|OFF ON|OFF ON|OFF

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

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.

Thanks

Hi,

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

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!

hi

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

Amber

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!

Jen

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

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,

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

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.

Hi Suma,

Simply enclose the cell value in quotes so that Excel interprets it as a text string, like this:

=$C2="MH000038"

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

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.

Hello!

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?

Hello,

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

Hello,

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?

Hello,

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?

hi

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?

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.

So:

2

3

4

2 <-- HIGHLIGHT

5 <-- HIGHLIGHT

6

8 <-- HIGHLIGHT

Thank you for your help

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.

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!!

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.

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.

Condition:

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

=$A$3=<1

=$A$3=$A$3

Hi,

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!

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.

Condition:

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

=$A$3=<1

=$A$3=$A$3

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.

Condition:

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

=$A$3=$A$3

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

A1 B1

Optimize 1

Use this Formula

=AND($B1>0, $A1="Optimize")

Select B1 Column.

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!

GREAT columb. More insightful than the videos. Thanks.

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

Hi,

Greetings.

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

Please kindly send the formula

Thanks

Ali Ahammad.

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.

hi,

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]

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?

Thanks!

Hello Christine,

Select the column A (from A2 till the end) and create a conditional formatting rule using this formula:

=COUNTBLANK($B2:$R2)=0

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.

=IF((AND(K11<TODAY(),K11"")),TRUE,FALSE)

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.

=IF((AND(K11<TODAY+60(),K11"")),TRUE,FALSE)

Any help would be greatly appreciated.

Thanks

Hi Steven,

The formula is correct except that parentheses should be after TODAY(), not after 60. Please try this one:

=IF(AND(K11<TODAY()+60, K11<>""),TRUE,FALSE)

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

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.

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:

=ISERROR(SEARCH("vlookup(",FORMULATEXT(A2)))=FALSE

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:

https://www.ablebits.com/office-addins-blog/2013/12/06/add-run-vba-macro-excel/

Replace FORMULATEXT with FORMULATEXT2 correspondingly:

=ISERROR(SEARCH("vlookup(",FORMULATEXT2(A2)))=FALSE

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.

Thanks.

I am sorry, but I don’t have any other suggestions.

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..

Hello John,

Select column B and create a rule using this formula:

=AND($B2="",$C2<>"",$A2<>"")

Hello Alexander,

Thank you very much for the formula, this is the exact one which I've been looking for. It really works !!! Thank you once again for your time for helping me...

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

14/02/2015

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.

Thanks,

Rachana

Hello Rachana,

Please select your column F from F2 to the end and then create a conditional formatting rule using the following formula:

=AND($F2="pending",$A2+5

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?

Hello Betty,

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

=B1=today()

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

=B1<=today()

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?

Hello Sarah,

Please use the Exact function and create two rules using these formulas:

Green: =EXACT(H8, "F")

Blue: =EXACT(H8, "f")

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!!!

Hi

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?

Thanks,

Heather

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

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,

Randy

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.

Heather

Hi,

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

Catherine

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

Thanks.

Hello Alan,

Select the range from B2 till B11 and create a conditional formatting rule using this formula:

=$A2=$B$13

Hi there I need solution for

If cell A10 = any value

Then cell A11 = 345 (fixed value)

Any 1 can help?

Hi!

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!

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...

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!

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!!

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.

Thanks!

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.

Two

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.

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.

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.

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.

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.

Hello,

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?

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?

Thank you, this tutorial was very helpful to me!

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

I NEED COLUMN F TO AUTOMATICALLY CHANGE TO RED OR GREEN. I NEED IT BASED OF COLUMN C.

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

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?

Hi,

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!

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.

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!

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

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.

Rules:

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!

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.

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!!

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.

Hello,

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.

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

Think I got it:

=AND(D1>=51,D1<=79)

Hi Fylum,

Oops, that way my omission. You are right, the AND function works for Between rules, just added it to the corresponding section in the post, thanks!

Hi,

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!

Maggie

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 ??

Thanks,

Nemish

hi,

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

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.

-Denise

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.

Example:

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!

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...

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:

$A24-1

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:

="$A24-1"

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

=$A$23:$A$526

Could the two be different conditions be the problem?

Thanks!!