Comments on: How to change the row color based on a cell value in Excel

Learn how to quickly change the color of the entire row based on a single cell's value in your Excel worksheets. Tips and formula examples for number and text values. Continue reading

Comments page 12. Total comments: 546

  1. I found my error, so used to quotations for references. Just had to follow the directions, substitute my settings, and it worked. Thank you for the tip!

  2. Yeah, I tried the conditional formatting based on an 1000 cell array where I need to highlight rows greater than a value. I even set the range for the values I wanted to check (in a single column, then highlighting the rows that cell is in where my established condition is true).

    I've got nothing. I've got a separate count for the cells in that column where my same condition exists, and I know for sure it is correct.

  3. Hi,svetlana
    Greeting of the day
    I want to formula for automotic bold for example..
    we find something in our data, after find it become automatic bold or color in excel sheet ,plz help us

    1. Hello Rajesh,

      You can create a rule with the formula like this: =SEARCH("text", $A2)>0

      And select "Bold" under the "Font style" on the "Font" tab of the "Format Cells" dialog.

  4. I want a useful formula for colouring if a cell value is less or more than original cell value. example, Invoice value is 5000 in cell D cell colour green/white, if received amount is less than 5000 cell colour to be red.

    pls reply.
    krr sharma

    1. Select column D and create two rules using the following formulas:

      Green Rule: =IF(AND($F2<>"", $D2>=$F2)

      Red Rule: =IF(AND($F2<>"", $D2<$F2)

      Where F is the column with received amount.

      1. HI,

        I tried with this formula, not working, pls clarify formula If I received an amount entire row coloured by green, If received less than amount entire row should be red.

        KRR Sharma

  5. Hiii....
    i want to get a formula & need your help...
    if cell d1=fail, then color of cell a2 is blue..how can i do this?

    1. Hi Nazmul,

      Simply select cell A2 and create a conditional formatting rule using this formula:
      =D1="fail"

  6. Hi Svetlana,

    I have a column of data that I will be adding to each day. It will occasionally be the case that the data I add will be a duplicate value already in the column above. Is there a formula in conditional formatting, that will highlight when this happens. Unfortunately using 'Remove Duplicates' or adding a filter is not sufficient as I just need the value highlighted straight away.

    Would be great if you could help out.

    best wishes,

    George

  7. Hello Svetlana,

    I tried to used the formula shown above, however when I change the dates in the cell to test the formula it does not make the necessary changes. Also, I want to express that I am using the conditionally formatting in a different column in which the dates are being used.

  8. I have a simple need. I need some text in a cell to be of two colors. in "Ending balance: Actual/Budget", the word "Budget" has to be in a different color. When I alter the color on the spreadsheet the program keeps reverting it to black.
    How can I do this?
    Thanks,
    Doug

  9. Hello Everyone,

    I have a report that I am attempting to use a conditional format to highlight a cell when the date which is locate in a different column is prior to 06/17/13. Can anyone assist me in sharing the formula to use.

    1. Hello Toni,

      Select the entire column with the dates you want to highlight (not including the column header, if any) and create a conditional formatting rule using this formula:
      =$A2<"06/17/13 (where A2 is top cell).

  10. Hi Svetlana,
    What if you want to highlight an entire row using a color scale that applies to only one column? That is, in your first example at the top, you have a Qty column, and you could easily select conditional formatting -> color scales, and select the color scale of choice. But if you want to copy that color scale across the other columns, excel thinks you want to update your color scale with the values in those columns. So if you try copying the formatting from column c to column b, it will just turn column b green and column c red (or whatever color scale you've selected). I want to highlight ALL of the rows by the relative order quantities. Is there a non-vba solution for this?

  11. Hi everyone

    I have a list of names, ID's, dates and hours and I would like to colour the last hour each day by ID/name. How can I do that?

    Thanks a lot!

    E.g.
    Name ID Date Hour
    A 1 5/11 8AM
    A 1 5/11 6PM (COLOUR THIS ONE)
    A 1 6/11 8AM
    A 1 6/11 12PM
    A 1 6/11 2PM
    A 1 6/11 6PM (COLOUR THIS ONE)
    B 2 5/11 9AM
    B 2 5/11 1PM
    B 2 5/11 2PM
    B 2 5/11 7PM (COLOOUR THIS ONE)
    B 2 6/11 8AM
    B 2 6/11 12PM
    B 2 6/11 2PM
    B 2 6/11 7PM (COLOUR THIS ONE)

  12. I have a very large organizational budget spreadsheet with multiple columns for each month. So November has Primarily two columns and, let's guestimate, 500 rows. I want to set the second column of each month up to auto code red/green if it's more than the planned amount for that bill (listed in column A).

    So picture Column A & B, 500 rows (technically still grouped out somewhat). Column A has ... Budget amt and Column B actual bill amt.

    --This would be Col A-- --This would be Column B--
    Nov Power Budget Amt Actual Bill
    LA Power $2700 $2407.22 (Green)
    Chic Power $1800 $2019.85 (Red)
    NY $1200 $1407.25 (Red)
    NewOrl Pow $1000 $859.36 (Green)
    Seattle Pow $3500 $3895.67 (Red)
    Miami Power $5000 $5262.98 (Red)
    MemphisPowr $2000 $1709.24 (Green)
    Denver Pow $4500 $4341.72 (Green)

    Currently I create this massive 12 month spread at the beginning of the year and set conditional formatting by the (i.e.) budget limitation listed in Column A to code Column B. However, this changes as certain bills do fluctuate throughout the year (Power, gas, etc.).

    I'm wondering if there's an easier way to do it? Such as Functions? And could I choose all of Column B above (while it was still empty of values) and set that whole section to 'format' appropriately as the values are entered by the line immediately to the left in Column A - without having to do it line by line? Groups are way better than 500 individual lines!

  13. I am currently using Excel 2010. I have a spreadsheet where most of the cells have a VLOOKUP pulling numbers from a separate tab in the same workbook. I am trying to set the cells so that they will change to a yellow fill if their value is not the same as another cell, i.e. J5 not equal to S5; J6 not equal to S6, etc. If the number in S5 changes, I would like it to automatically change J5 to yellow. Currently, I can get J5 to change to yellow when I first apply the conditional formatting and S5 is a different number than J5, but if I change S5 to the same value as J5, it will not remove the yellow fill from J5.

    1. Hello,

      This is really strange. The following simple formula works perfectly for me:
      It looks strange. There should be a simple formula in your conditional formatting rule:
      =$S5<>$J5

  14. Hello Svetlana,

    It is possible to highlight current day from a calendar using conditional formatting.

    Thanks in advance

    1. Hello Poc,

      Of course, you can do this using the following formula:
      =$A2=TODAY()

      Where A2 is the first cell with a date in the column.

  15. Hi,

    How can hightlight the Name as RED where amount is <5000.

    1. Hi!

      Select the names you want to color and create a rule with this formula:
      =B2<5000

      Where B2 is the first cell with data in the Amounts column.

  16. Hi Svetlana,

    thank you for your reply, I had actually resolved the problem and was about to inform you when I saw your reply.

    The error was part my fault caused when transposing the simplistic example I gave you into the actual values I am using and the use of a semi colon.

    Thank you very much for your assistance.

    Paul

  17. Thank You Svetlana,

    I will try this and provide feedback.

    Paul

    1. Hi Svetlana, I have tried your proposed code but it does not appear to work!

      The code for Blue is fine, however I cannot get the other two lines to work correctly!

      When I enter each of the lines a prompt states that there is an error, I am using excell 2007, is there any other suggestion you can offer.

      Thanks Paul.

      1. Hi Paul,

        I use Excel 2013, though it should not actually make any difference. The rules work just fine in my sample workbook.

        The only possible reason that comes to mind is that you have a semicolon rather than comma set as List separator in your Windows Regional settings, which is the standard for European countries. You can check this in Control Panel > Region and Language > Additional Settings. If this is the case, then you have to replace all commas with semicolons in the formulas.

        If this does not help, you can send me your workbook at support@ablebits.com, and we will try to figure this out.

  18. Hi I am trying to improve a document in which I am already using conditional formatting. At present, Cell H9 contains a drop down list of equipments, when nothing is selected in H9 the background is blue, however whenever an equipment is selected the cell is set for no highlighted colour. In Cell H49 I have to record the current software version of the equipment, again if the cell is empty the background is blue, if the software version is correct the background is clear, however if the software version has been superseded this cell reverts to red.

    The specific data within H49 is directly related to the data entered in H9, but as yet their conditional formatting is not set up as such, therefore any current version of software is always indicated as being correct, even if the equipment in H9 is not the correct system for the selected software version.

    If as an example the systems are called a, b and c and their software versions are 1a, 3b and 4e, respectively, is it possible to produce a formula that ensures the conditional format of H49 is directly related to the specific data in H9 such that:
    1. With no entry in H49 the background is Blue (This code is curently in use).
    2. Only when H9=a and H49=1a, or H9=b and H49=3b or H9=c and H49=4e, the background is clear(denoting software is up to date).
    3. Any other configuration is highlighted red(Incorrect software version for system selected in H9).

    If you can assist it would be greatly appreciated. I look forward to recieving a response.

    Regards

    Paul

    1. Hello Paul,

      If my understanding of your task is correct, the following formulas should work a treat.

      So, select the cell you want to highlight (H9 or H49) and create 3 rules:

      Blue: =$H$9=""

      No color: =OR(AND($H$9="a",$H$49="a1"), AND($H$9="c",$H$49="e4"), AND($H$9="b",$H$49="3b"))

      Red: =OR(AND($H$9="a",$H$49="a1"), AND($H$9="c",$H$49="e4"), AND($H$9="b",$H$49="3b"))=FALSE

  19. This tutorial or instructions looks great, but doesn't work easier at least for me. I am using Excel 2010, whenever I use the formula |=SEARCH("Due in", $E2)>0| I am getting an error :(

    --
    Jena

    1. Hi Jena,

      What exactly error do you get? This is a very simple formula, and there is absolutely no reason for it to produce an error.

      I can think of just 2 possible reasons:

      1. Straight quotes in the formula were replaced with smart quotes while copying. Please try retyping the formula directly in Excel.

      2. You have a different List separators set in your Windows Regional settings, e.g. semicolon, which is the standard for European countries. You can check it in Control Panel > Region and Language > Additional Settings. If this is the case, the correct formula will be =SEARCH(“Due in”; $E2)>0

      If neither is the case, you can send me your sample workbook at support@ablebits.com and we'll try to sort it out.

  20. Hi Svetlana
    I am using excel 2007 I am an absolute begginer to excel and I am trying to create a work sheet to map the progress of a given number of tasks to be done to complete one job before moving on and repeating the same tasks to the next job and so on.
    C2:K2 are tasks to be done, each I have given their own color.
    Apon entering say 091014216(09/10/2014 2.16pm)in the cell under first task I want the intire row to change to that color at the same time adding 10% to K2(% complete)and when I enter say 091014529 in the cell in the next column the color of the row would change from the previous colour to this tasks color (and add 10/20% to K2. And so as the rows get filled with numerous jobs I can at a glance see the the color a particular job is at and and how near completion. I tried the above formula in the new formatting rule window but it only changed the color of the one cell I entered C4 even though I entered =$C4>0. Is this because I`m using 2007 excel? or can this be done?

    1. Hello Joseph,

      For me to be able to help you better, please send a workbook with your sample data to support@ablebits.com and specify how you want to highlight the cells.

      1. Hi Shetland
        Thanks for your prompt response unlike my own.
        Very sorry for not getting back sooner but I am away from my home computer where I have this workbook started. As soon as I am back I will be in touch.
        Joe

  21. Svetlana - you're awesome! Thanks so much for the great tutorial. Very helpful in my keyword research efforts - and I will link to this page when I blog about it :-)

    nazdrovya

    Gary

    1. Thank you very much for your kind words, Gary! Nice to know my article has been helpful.

  22. What if I want to color an entire row with a cell that containing a specific text

  23. Hi,

    I understand conditional formatting well.
    I have set of combinations, each of which corresponds to a row (Say 10 Set with 5 values for each set. So 10 X 5 Table). So If I select any cell in a row, I should project corresponding colour code based on values (5) on this row.

    I can do conditional formatting for colour coding. But how can I take a set of input at a time to do so.

    Can I do this in Excel?

    1. Hello Shun,

      If my understanding is correct, you want to pick the color code of the current cell and use it as the background color for all the cells in this row.

      Unfortunately, I don't know the way to fulfill this task using conditional formatting formulas. Most likely, a special VBA macro is needed.

  24. Hi Mam,
    i ve to change colour based on a cell value and i couldnt find any answers. for eg., if cell a1 value is 2,the next two coloums must be coloured if it is 3 then next three colums must be coloured. when i increment the cell value the no of colored coloumns must be increased. plz help me...

  25. Hi,
    I wanted to learn using formula on color changing in a cell as reminder. For instance, if say a lease for Mr. XYZ expires on 15/12/2014 and i want a reminder 2 months in advance to follow up renewal/non-renewal. How do I do that if I wish the color to change and understand that it is time for a follow up?

  26. Hi, I want each cell in column "D" to be colored Yellow if the value is less than that of the matching cell in that row in column "C". I can do it one at a time but I have hundreds to do. Is it possible to write one conditional format for all?

  27. Hi,

    I have problem in solving for the formula. I'd like the three cells have same color with I select name for example "Jimmy".

    Date Doc Id Auditor

    Please advise for the appropriate formula using the conditional formatting.

    Thanks

  28. I work with students and I need to know if they are behind. If I have a cell that has a text value ("Y" or "N") and one that is counting days (45). How would I get the row to change to red if I have a "N" condition and a >21? Thank you for any help.

    1. Hi Erik,

      Try this formula:=AND($B2="N",$D2>21)

      Where $B2 is the first cell of the Y/N column, excluding headers; and $D2 is the first cell of the Days column.

      1. Thank you for the help. It works perfectly. I have over 140 rows. Is there a way to apply the formatting to work individually with each cell without having to manually go to each cell? Thank you again for your help.

        1. Simply apply that rule to all 140 rows. Click Conditional Formatting > Manage rules, and change the range in the box under "Applies to". Since you use relative row references in the formula (without the $ sign), the rule will be applied to each row individually.

  29. If suppose change the particular cell value from 5 to 3 etc.. now need to highlight color wherever we changed value

    1. Hello Sabarish,

      Do you mean you edit the cell manually and you want that cell to change the color once the value is changed? Do you want the cell to keep the color when a workbook is closed and then re-opened?

  30. Wow, thanks a lot for those tips, it will help a lot!!!

  31. THanks alot it helped!!

  32. Hi, I work on rotation updates and i colour code them based on the stage they are for example if i have initiated the visa process then i colour them in Yellow and if they are on rotation - Green and so on. What i want to know is if i create a table as below

    1 In Process
    2 On the ground
    3 Returned
    4 Complete

    And another table with the rotator details, i would want to automate the colours when ever i update the rotator details. For example : If i input 1 in Row A1 then i want the entire row to be coloured and if i input 2 in row A2 then it should coloured to a different colour. Is this possible with conditional formatting?

    THanks for your help!

    1. Hi Sudha,

      You can select all the rows that you want to get colored (entire rows without column headers) and create several rules, a rule per each value in column A, with the following formulas:
      Green: =$A1=1
      Yellow: =$A1=2
      etc.

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

  33. Hi, I need a formula to colour cells based on what I sell.

    I have spreadsheet with a code for what I sell, so household HC, car PC and van GV at the start of the row.

    I also have a few other things in the row, is there a way for colouring the row based on what I put in, so HC - blue row, GV - orange row?

    Thank you

    1. Hi Will,

      Of course, you can do this. Simply select the entire table and create a separate rule for each code with the below formulas (assuming that your codes are in column A and row 2 is your top-most row with data):
      Blue: =$A2="HC"
      Orange: =$A2="GV"

  34. HI..Is there a way where by i click on a cell which has any value and it changes it color...and also of copying value of cell into another cell in different spread sheet by clicking on it or any other manner.

    1. Hi Rakesh,

      Both of your tasks can be accomplished using VBA. But actually I do not see any point in writing a special macro for the first task since it takes just a click on the Fill Color button on the ribbon to color a cell.

  35. Hi ablebits,

    I am having trouble with the =SEARCH(“pine”, $E7)>0 formula described in this article, (I've adapted it to fit my criteria) it just doesn't work. I require the row ranging from E7 to H7 to change colour when 'pine' is in cell E7.

    Cell E7 has numbers preceding the text, e.g '4.2 Pine'. Also, the cell contents are selected using a drop down box (via data validation). Will either of these affect the formula?

    Look forward to reading your reply

    Jon

    1. Hi BSWjon,

      Conditional formatting rules work with drop down list values as well as with normal values. Your formula is also correct, I've just tested it on similar data (drop box, preceding text) and it has worked perfectly. If you can send me your sample workbook at support@ablebits.com I think we will be able to figure out the cause of the problem.

  36. Hi Svetlana,

    I am struck at one point in my excel sheet, the client needs to detect all red colored cells in a column, and give them a code like "L" and copy in the corresponding empty row. I am not sure how I should move....

    I am looking for your kind guidance in this regard.

    Thanks
    Shikha

  37. hi...i have a data for product pricing let say from day 1-10. i want to read the data fast. for me to do that i want to see which items increase, decrease and retains the same from day 1 - 10. is it possible for conditional formatting? thank you.

    1. Hello Mir,

      I believe you can use Excel Icon Sets for this, e.g. three arrow set.

      You could create an additional column with a formula that calculates the difference between Day 10 and Day 1, say =P2-G2 (where P2 is Day10 and G2 is Day1). Apply an icon set to this column and select the box "Show icon only".

      1. Hello Svetlana,
        I have a list of data start from January To December.
        Data contains Month wise "Input Data" & "Target Data".
        I want to change the color of the cell in "Input Data" if that particular month's "Input Data" less that the "Target data" for that month.
        Also My target data for every month is changing.It starts from 0%,12%,24%...to 100%.

        Can you please help me for that?

        Please mail me your response on mail.

        Thanks,
        Mayur k.

  38. I am trying to change the row colour based on the word 'PAID' in one cell but I cannot make it work. I have tried all that you have suggested above and am at the point of tearing my hair out! please help!

    1. Hi Dee,

      Try this:

      - Select all the rows you want to color, excluding the header row, if any.
      - Go to Conditional Formatting > New rule > Use a formula to determine which cells to format.
      - Create a rule with this formula =SEARCH("PAID", $C2)>0 Remember to replace C with the name of your column that contains the word PAID. If your data starts in a row other than 2, replace 2 with the corresponding row number.

      If the formula still does not work for you, please send me your sample workbook at support@ablebits.com and we will figure out the cause.

  39. Hi Svetlana,

    Lets say there are two colums
    A B
    11 13
    12 9
    13 15
    5 55

    If the value of B is greater than that of a, the value in B should be green color else red. How do i go about doing that?
    Thanks
    J

  40. Hi,

    I have a problem with icon sets. I'm supposed to obtain green flag in cell A5 if there is any value (combination of letters and numbers) in cell F5 and red flag in the case that there is no value. I need a solution for entire column A (flags) and F (values).

    Thank you in avance.

  41. Hi,
    Can you help me in one case
    My requirement is "I just want to highligt the cell (by colour) if any changes done after a particular date.

    1. Hi Marina,

      I think this can be done only via a macro. Regrettably, there are no such rules in Excel conditional formatting.

  42. I need a little help...

    I am trying to get the whole row text to change colour based on entries in column S.

    I go to conditional formatting and choose a new rule. I then pick use a formula to determine which cells to format. I then put the following formula in: =$S7="2015 callback"

    I change the format so that the text will change to purple.

    Once I have done all this some cells change but these are rows of cells where the information in column s is not "2015 callback"

    How can I manipulate this excel spreadsheet to do as I want?

    Thanks

    1. Hi Laura,

      Your formula is correct. Just make sure please that you apply it to the right range of cells. For example, if row 7 is your first row with data, then you should select the range starting with A7.

      If your data starts in some other row, e.g. row 2, then you should change the formula accordingly: =$S2="2015 callback"

      I have created a similar rule for column C and it works just fine:
      Conditional formatting rule

  43. Hi ,

    I am able to achieve conditional formatting , but i also have hierarchy in my sheet , so after applying conditional formatting if i try expanding hierachy my foramtting is disappearing .

    Can you please help , I have applied applied sap styles for my hierarchy.

    How to lock the conditional formatting , i mean it should retain/remain after expanding hierarchy.

    Thanks in advance.
    Mamatha

    1. Hello Mamatha,

      I am sorry I do not quite understand what exactly you mean by "hierarchy" in your sheet. Is it group subtotal or something else? Anyway, it would be easier to determine the source of the problem if I could have a look at your data. You can send me your worksheet at support@ablebits.com and I will do my best to help.

  44. Hi Svetlana,

    Could you please help me
    I try to use formula, for example

    =SEARCH("anymatch",A1)

    But catch error "We found a problem with formula... Now trying to type a formula? When the first character is an exusal (=) or minus (-) sign, Excel thinks it's a fomula"...

    And I can't save Formatting rule.

    Thanks

    1. Hi Alexey,

      If you have the Russian regional settings, then you should use a semicolon instead of a comma in your formula (unless you changed this in the regional setting in control panel).

      Also, please note that if you want to find the specified text in any position in a cell, the formula reads =SEARCH("anymatch";A1)>0. If a cell's contents should start with the specified text, then use =SEARCH("anymatch";A1)=1

      If the error persists, please let the know the full formula, exactly as you are entering it in a rule. In this way, it would be easier to test and pin down the root of the problem.

  45. How would I do this if I wanted it black out a row with any text in a column cell? For example a termination date. If there is any date entered in that column it blacks that employees info.

    Thanks

    1. Hi Kyle,
      You can select the entire table and create a rule with this formula (assuming that your table has headers and data starts in row 2):
      =$B2<>"" where B is your termination date column. Naturally, you choose the black fill color.

  46. I am trying to format a sheet so that when a date is entered in a row in column K the entire row is coloured yellow. However when a second date is entered in the same row in column L the row is changed to red. I know this should be simple but I am having issues getting it to work.

    1. Hello Lu,

      I think you can create 2 rules with the following formulas and apply them to the entire table:
      1) =$K1<>"" - yellow fill color
      2) =AND($K1<>"", $L1<>"") - red fill color. Check the option "Stop if true" next to this rule and make sure it comes first in the rule list.

      The rules will color your spreadsheet correctly if only dates are allowed in columns K and L, because as you understand, the formulas will work if any value is entered in those 2 columns. Hopefully, this solution is suitable for your task.

  47. Hello. I am trying to use your formula but somehow I am missing something. I want to highlight the entire row in green if C1 has the text "completed". Not sure what I'm doing wrong.

    1. Hi Thelma,

      You can do this by selecting the entire table where you want to color the rows and creating the conditional formatting rule with this formula:
      =$C1="completed"

      If C1 may contain some other words, e.g. "completed last week", then you can use this formula for partial match.
      =SEARCH("completed", $C1)>0

      Also, make sure you use straight quotes in the formula, they are often changed to smart quotes when copying / pasting from web-pages.

      If the rule still does not work, please send me your workbook at support@ablebits.com and I will try to help.

  48. Great tutorial. Is very helpful and saved my time lot. Thank you.

  49. Hi! I have a lot of columns in a worksheet. If there is a number greater than 0 in a cell of 1 specific column, I want the first cell of the row where the number greater than 0 is located to become highlighted. Is that possible?

    It is not highlighting the entire cell but a cell in that row. Thanks in advance!

    1. Hi,

      Yes, you can do this in the following way:
      - Select only the column where you want to color cells (except for the header row, if any). Suppose this is column A.
      - Create a conditional formating rule with this formula: =$C2>0 where C is your specific column. If your table does not have headers and your data starts in row 1, then use =$C1>0

      Since we use a mixed reference in the formula (absolute column and relative row), the formula will highlight the first cell (A) of each row where the value in column C in greater than 0.

  50. Hello, I have an easy one. I need to highlight today's date row and then the next row as well (not just the next date). I have multiple rows for one date box.
    ex: 1/1/14 row a highlight this row
    row b highlight this row
    1/2/14 row a
    row b

    I have today's date row highlighted, but now the row b. The Row b first box covers and row a first box is the same box expanded over the two rows.

    1. Hi Josh,

      You just need to create one more rule for the same range with this formula =TODAY()=$C1

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