Comments on: Excel conditional formatting formulas based on another cell

This tutorial explains how to use Excel formulas to format cells and entire rows based on the values you specify or based on another cell's value, and provides a handful of formula examples. Continue reading

Comments page 39. Total comments: 1726

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

    1. Hi Rob,

      Just use absolute column references (with the $ sign) like this:
      =$D3>$C3 and =$D3<$C3

  2. Hi Svetlana,

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

    Any help you can provide would be much appreciated.

    Thank you!

    1. Hi Nicole,

      I would advise to double check 3 most obvious things:

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

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

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

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

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

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

    Any help would be appreciated!!

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

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

  5. Thanks For the tutorial..

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

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

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

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

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

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

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

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

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

    2. Think I got it:
      =AND(D1>=51,D1<=79)

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

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

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

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

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

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

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

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

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

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

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

  24. Thank you, this tutorial was very helpful to me!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Hello Alan,

      Select the range from B2 till B11 and create a conditional formatting rule using this formula:
      =$A2=$B$13

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

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

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

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

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

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

    1. Hello Sarah,

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

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

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

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

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

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

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

    1. Hello John,

      Select column B and create a rule using this formula:
      =AND($B2="",$C2<>"",$A2<>"")

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

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

    1. 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/add-run-vba-macro-excel/

      Replace FORMULATEXT with FORMULATEXT2 correspondingly:
      =ISERROR(SEARCH("vlookup(",FORMULATEXT2(A2)))=FALSE

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

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

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

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

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

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

    1. Hello Christine,

      Select the column A (from A2 till the end) and create a conditional formatting rule using this formula:
      =COUNTBLANK($B2:$R2)=0

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

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)