How to change the row color based on a cell's 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.

Last week we discussed how to change the background color of a cell based on its value. In this article you will learn how to highlight entire rows in Excel 2016, 2013 and 2010 based on a value of one cell, and also find a few tips and formula examples that will work with numerical and text cell values.

How to change a row color based on a number in a single cell

Say, you have a table of your company orders like this:
Source data - a table of the company's orders

You may want to shade the rows in different colors based on the cell value in the Qty. column to see the most important orders at a glance. This can be easily done using Excel Conditional Formatting.

  1. Start with selecting the cells the background color of which you want to change.
  2. Create a new formatting rule by clicking Conditional Formatting > New Rule… on the Home tab.
    On the Home tab, click Conditional Formatting > New Rule…
  3. In the "New Formatting Rule" dialog window that opens, choose the option "Use a formula to determine which cells to format" and enter the following formula in the "Format values where this formula is true" field: =$C2>4
    Open the 'New Formatting Rule' dialog and enter the needed formula.

    Instead of C2, you enter a cell that contains the value you want to check in your table and put the number you need instead of 4. And naturally, you can use the less (<) or equality (=) sign so that your formulas will read =$C2<4 and =$C2=4, respectively.

    Also, pay attention to the dollar sign $ before the cell's address, you need to use it to keep the column letter the same when the formula gets copied across the row. Actually, it is what does the trick and applies formatting to the whole row based on a value in a given cell.

  4. Click the "Format…" button and switch to Fill tab to choose the background color. If the default colors do not suffice, click the "More Colors…" button to pick the one to your liking, and then click OK twice.
    Click the 'More Colors…' button to choose the color to your liking.

    You can also use any other formatting options, such as the font color or cells border on the other tabs of the Format Cells dialog.

  5. The preview of your formatting rule will look similar to this:
    The preview of your formatting rule
  6. If this is how you wanted it and you are happy with the color, click OK to see your new formatting in effect.

    Now, if the value in the Qty. column is greater than 4, the entire rows in your Excel table will turn blue.
    The background color of entire rows is changed based on value in the specified cell.

As you can see, changing the row's color based on a number in a single cell is pretty easy in Excel. Further on, you will find more formula examples and a couple of tips for more complex scenarios.

How to apply several rules with the priority you need

In the previous example, you may want to highlight the rows with different values in the Qty. column in different colors. For example, you can add a rule to shade the rows with quantity 10 or greater, say, in pink. In this case, use the formula =$C2>9, and after your second formatting rule is created, set the rules priority so that both of your rules will work.

  1. On the Home tab, in the Styles group, click Conditional Formatting > Manage Rules… .
  2. Choose "This worksheet" in the "Show formatting rules for" field. If you want to manage the rules that apply to your current selection only, choose "Current Selection".
  3. Select the formatting rule you want to be applied first and move it to the top of the list using the arrows. The result should resemble this:
    Use the up and down arrows to set the rules' priority.

    Click the OK button and the corresponding rows will immediately change their background color based on the cell values that you specified in both formulas.
    The entire rows colored based on two conditional formatting rules

How to change a row color based on a text value in a cell

In our sample table, to make follow-up on orders easier, you can shade the rows based on the values in the Delivery column, so that:

  • If an order is "Due in X Days", the background color of such rows will turn orange;
  • If an item is "Delivered", the entire row will be colored in green;
  • If an order is "Past Due", the row will turn red.

Naturally, the row color will change if the order status gets updated.

While the formula from our first example could work for "Delivered" and "Past Due"(=$E2="Delivered" and =$E2="Past Due"), the task sounds a bit trickier for "Due in…" orders. As you see, different orders are due in 1, 3, 5 or more days and the above formula won't work because it is purposed for exact match.

In this case, you'd better use the =SEARCH formula like this =SEARCH("Due in", $E2)>0 that works for the partial match as well. In the formula, E2 is the address of the cell that you want to base your formatting on, the dollar sign ($) is used to apply the formula to the entire row, and >0 means that the formatting will be applied if the specified text ("Due in" in our case) is found.

Tip: If you use >0 in the above formula, it means that the row will be colored no matter where the specified value or text is located in the key cell. For example, the Delivery column (F) may contain the text "Urgent, Due in 6 Hours", and this row will be colored as well.

If you want to change the color of rows where the contents of the key cell starts with the indicated value or text, then you need to use =1 in the formula, e.g. =SEARCH("Due in", $E2)=1. However, be very careful when using this kind of formula and ensure that there are no leading spaces in the key column, otherwise you might rack your brain trying to figure out why the formula does not work :) You can use this free tool to find and remove leading and trailing spaces in your worksheets - Trim Spaces add-in for Excel.

Create three such rules following the steps from the first example, and you will have the below table, as the result:
The rows' color is changed based on a text value in a cell.

How to change a cell's color based on a value of another cell

In fact, this is simply a variation of changing the background color of a row case. But instead of the whole table, you select a column or a range where you want to change the cells color and use the formulas described above.

For example, we could create three such rules to shade only the cells in the "Order number" column based on another cell value (values in the Delivery column).
Changing a cell's color based on a value in another cell

How to change a row's background color based on several conditions

If you want to shade the rows in the same color based on several values, then instead of creating several formatting rules you can use the =OR or =AND formulas to set several conditions.

For example, we can color the orders due in 1 and 3 days in the reddish color, and those that are due in 5 and 7 days in the yellow color. The formulas are as follow:

  • =OR($F2="Due in 1 Days", $F2="Due in 3 Days")
  • =OR($F2="Due in 5 Days", $F2="Due in 7 Days")

Use the =OR formula to change a row's color based on several conditions.

And you can use the =AND formula, say, to change the background color of rows with Qty. equal to or greater than 5 and equal to or less than 10: =AND($D2>=5, $D2<=10).
An example of using the =AND formula

Naturally, you are not limited to using only 2 conditions in such formulas, you are free to use as many as you need, e.g. =OR($F2="Due in 1 Days", $F2="Due in 3 Days", $F2="Due in 5 Days") and so on.

Tip: Now that you know how to color cells to differentiate between various types of values, you may want to know how many cells are highlighted in a certain color and calculate the sum of values in those cells. The good news is that you can automate this too and you will find the solution in this article: How to count, sum and filter cells by color in Excel.

These are only a few of many possible ways to zebra stripe your Excel worksheets based on a cell's value that will respond to change of data in that cell. If you need something different for your data set, drop us a comment and we will try to figure this out.

466 responses to "How to change the row color based on a cell's value in Excel"

  1. mir says:

    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.

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

      • Mayur Kalaskar says:

        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.

  2. shikha says:

    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

  3. BSWjon says:

    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

  4. RAKESH says:

    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.

  5. Will says:

    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

  6. Sudha says:

    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!

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

  7. Sudha says:

    THanks alot it helped!!

  8. Joel says:

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

  9. sabarish says:

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

  10. Erik says:

    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.

  11. Marlon says:

    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

  12. Tom Wells says:

    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?

  13. Jay says:

    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?

  14. Lakshmi says:

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

  15. Shun says:

    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?

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

  16. LULU says:

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

  17. Gary Nugent says:

    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

  18. Joseph Ward says:

    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?

  19. Jena says:

    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

    • 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. Paul Jando says:

    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

    • 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

  21. Paul+Jando says:

    Thank You Svetlana,

    I will try this and provide feedback.

    Paul

    • Paul+Jando says:

      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.

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

  22. Paul+Jando says:

    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

  23. pradeep kumar says:

    Hi,

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

  24. Poc says:

    Hello Svetlana,

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

    Thanks in advance

  25. Anonymous says:

    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.

  26. TCP says:

    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!

  27. Anna says:

    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)

  28. Nathaniel says:

    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?

  29. Toni says:

    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.

  30. Doug says:

    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

  31. Toni says:

    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.

  32. George Rolls says:

    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

  33. Nazmul says:

    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?

  34. KRR+Sharma says:

    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

  35. Rajesh kaushik says:

    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

  36. Dave Staccato says:

    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.

  37. Dave+Staccato says:

    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!

  38. Chloe H. says:

    Hello

    I'm not sure if posted above, but I have one query.

    I am using the conditional formatting formula to highlight a range of cells in a row based on a single cell.

    I need to do this for 100+ rows. All the same range, but one row after another.

    Instead of creating a new condition for each row and cell, can I copy this and apply to each row?

    For example, cells B2 to J2 will highlight when K2 >0.

    Can I copy this to apply to B3 to J3 when K3>0 and so on?

    I would appreciate any help!

    Many thanks :)

    Chloe

    • Shannon says:

      You can usually do this if you use... when$k2>0... This tells it to always use column K. Continue conditional formula as normal.

      Go back to conditional formatting to edit. Under your applies to change it to =$B$2:$J$100. (or whatever your final row is)

  39. Lisa says:

    Hello,

    I am trying to make each row change color if within a date range. For example, I would like a specific color for each month. If I type a January date it will be one color, but a February date would be another. I can't seem to figure out how to write the formula for the date range.

    Thanks!

    • Shannon says:

      Lets say your dates are in column A. Click in that cell

      Go to Conditional Formatting. New rule..

      Use a formula to determine which cell to format.

      Under formatting values. Type in =A1="January"

      Click format and choose your color for that month. Say okay. The window will disappear.

      Click again on conditional formatting and go to manage rules. First double click the rule. It should be something like = $A$1="January". Remove the dollar sign before the 1. Leave the 1 before the A. In the applies to change it to =$A$1:$last column letter $ lastrow number

  40. Praween says:

    I have a Question when we find any data in spreadsheet through Ctrl+F than that cell Present in a colour based how to use this query.

  41. Ven says:

    Hi Svetlana,

    Could you please help me.
    For example, if A1 have a text then B1 will be filled by color,
    if A2 have a text then B2 will be filled by color.

    I trying to do the formula, but the result is Even A2 blank, B2 filled by color.
    Any idea for the formula.

  42. Jatin says:

    Hi Svetlana,

    Could you please help me.

    I want to change the value of cell based on this condtion.

    if A1 cell is coloured Green and B1 cell has value "Yes"
    than B2 automatically gets converted into "Yes".

    Thanks in Advance

  43. Brooke says:

    If I have a worksheet with data across columns A to G, I want to use the formula =MOD(ROW(),2)=0
    to alternate row colours BUT I need to be able to insert rows sometimes when the data in Column D needs to be the same colour as row above .....

    Thanks in advance

  44. arvind says:

    Q. 2 If we put the value >0 to <2000 in column B then column C should be red. In conditional formating

    Value Cell Color
    2
    4
    -10
    800
    -1691
    1500
    3500

    Need Solve

  45. Anonymous says:

    Any one Help me

    Q. 2 If we put the value >0 to <2000 in column B then column C should be red. In conditional formating

    Value Cell Color
    2
    4
    -10
    800
    -1691
    1500
    3500

    Need Solve

  46. Abhishek says:

    In my excel I have two columns Colum B "Account Type" and Column C "Account name"
    Column C has all the account names such as Global travel etc... and Column B which is account type as either Account or Agency mentioned in the cells

    What I am looking for is to have a formula which highlights cells in column B and C when it finds the word "Travel", "Tour", "Agency" in column C and word "Account" in column B .

    Please note it should only highlight when both these criteria are met

  47. Motwaly says:

    Hi Svetlana

    B10060000005
    B10060000005
    B10060000006
    B10060000006
    B10060000007
    B10060000007
    B10060000008
    B10060000008
    B10060000009
    B10060000009
    B10060000023
    B10060000023

    could you please assist I need to give each row contain the same cell value same color, example entire row contain B10060000005 with green, B10060000008 blue ...etc, thank you

  48. Zoudan says:

    Awesome, thank you SO much!!

  49. ericalee says:

    Hi there, thank you for your helpful article! I am making a two sheet workbook intended to show my company what customers we can contact to let them know a product that they are looking for is coming in on our next shipment. The first sheet is the customer's information and in column A is the style number of the product they are looking for. The second sheet will be where we copy and paste the style numbers of everything we are expecting in on our next shipment. I need to make each row in sheet 1 highlight if the value in column A matches any value in column A of the second sheet. Note, I will be deleting and reentering all style numbers in column A of the second sheet to always be showing our most current shipment, so I cannot enter a specific value to match in the formula because it will always be changing. Thank you for your help on this!

  50. chantel says:

    Hi,
    Can you please help me with my formula?!

    =OR($D>=20%, $E=8%, $E>=4,$E=3%, $E>=7)
    COLOR GREEN

    =OR($D<=20%, $E<=3),OR($D=4,$E<=6),OR($D=7)
    COLOR RED

    1-3 ranking + ctr >20% = green
    1-3 ranking + ctr 8% = green
    4-6 ranking + ctr 3% = green
    7-10 ranking + ctr <3% = red

    Thanks
    Chantel

  51. kishore ssk says:

    Hi Experts,

    I have copy pasted data from some website and pasted the content in a cell , say "HELLOWORLD". HELLO is in blue and WORlD is in black.I need to put a ',' after the blue font. so it looks "HELLO,WORLD"
    Can i do it? if yes how ?

    Note- for limited number of records i could have done it manually but i have lakhs of records and i cannot do it all alone manually.
    I want to automate it with some code.

    Please help

    Thanks in advance
    SSK

  52. Hardik says:

    Hi,

    There is any data in xls but somewhere we are correcting the numbers so i want to highlight such raws where we are doing the correction.

    Can you please help me with this?

    Thanks
    Hardik

  53. Tom says:

    How to change a row color based on a number in a single cell worked great. Except I also have your formula to count cells by color and the colors for the conditional formatted cells shows as "no color" in the cells formatting.

  54. maricel says:

    hi just asking please help how to change the color automatically if i input # 4 it will change in other sheet in the entire row it will change color blue.

    for ex. 1 pink
    2 yellow
    3 green
    4 blue

  55. ANUPAM BHATNAGAR says:

    Sir,
    My problem is when I put formula in one the background and font color should change accordingly.
    For example:
    A B C D E F G H I
    1 BUY SELL PROFIT
    RATE RATE /LOSS
    2
    3 2500 3000 500 I WANT THIS CELL BACKGROUND GREEN
    4
    5 6000 5500 -500 I WANT THIS CELL BACKGROUND RED

  56. Bharath Kumar R says:

    Hi Svetlana Cheusheva,
    I wanted to send reminders to the stakeholders while exceeding 3 days from last reminder date. I have used the below formatting but I could not highlight the entire rows and also want to ignore weekends (Saturday and Sunday).
    Formula used, E.g.,
    =$D$2-TODAY()>=3
    Thank you.

    • Hi Bharath,

      First off, please check whether your rule applies to the entire rows you want to highlight (without the column headers).

      Assuming that the last reminder date is in column D, you need to change your formula as follows:

      =TODAY()-$D2>=3

      Please pay attention that $D2 should be a mixed cell reference (absolute column - with $ and relative row - without $).

      Finally, create one more rule to exclude Saturday and Sunday (do not choose any fill color), move it to the top of the rules list and check "Stop if true" next to it:

      =WEEKDAY(D$2,2)>5

  57. Chris says:

    I need a formula that will make cell "A3" turn Green when cells "E3 through L3" contain the letter "Y"

    and also

    "A3" turn Red when cells "E3 through L3" contain the letter "N"

  58. Sophie says:

    Hi Svetlana

    I am trying to figure how to format my worksheet so that it identifys by changing colour if a number is less than the number it was previously e.g. something weighing 12kg then in the next coloum, ideally they will be 13. But if it ends up weighing less, e.g. 11, then it would highlight this for the entire worksheet not just for the one row/cell.
    Are you able to help me? I am tearing my hair out!
    Thanks
    Sophie

  59. Prashant Johari says:

    Hi Svetlana,

    I am trying to automatic highlight the high value in each row.

    For Example threre are some figure in each coloum i.e. :-

    ColumnA ColumnB ColumnC ColumnD
    1. p 10 15 12
    2. n 15 12 14
    3. q 10 04 20
    4. r 15 20 25

    now, which condition i used that the autmatic highlight the high vlue in each row.

    Regards,
    Prashant Johari

  60. senthil says:

    thank you so much Svetlana Cheusheva

  61. Omar says:

    I need to change the colour of the font in the row that the date is three years from today (All expired items). When I use conditional formatting the column the date only changes please help. Regds, Omar

  62. Bruce says:

    I have a task I perform on a date and I enter the date into Cell A1. What I want to do is have the cell B1 turn to red when I am 7 days past the date I entered into Cell A1. Can you tell me how to do this?

  63. Jason James says:

    Thank you Svetlana, this article was very helpful.

  64. Kyle VandenLangenberg says:

    How about highlighting a block of cells based on the value changes in just a single column.

    For instance, say I have columns A and B. Down column A I have numbers like 1,1,1,2,2,3,3,3,3,4,4,4,5,5,5, and whats down column B is non-consequential for this example. Every time column A changes value (from 1 to 2, 2 to 3, and so on), I want to highlight the cells in both column A and B with a different color. The color can simply rotate between two colors.

    Say it was setup like this (x is just some other information)

    A B
    1 x
    1 x
    2 x
    2 x
    2 x
    3 x
    3 x

    I want A1,A2,B1,B2 to be one color, then A3,A4,A5,B3,B4,B5 to be another, and so on.

    Thanks for the help in advance.

  65. Hollywil says:

    I would like the entire row to be highlighted based on the contents of column I ---- either that there is NO value (rather than ANYTHING) if that's possible.... or if there is a "," in the cell text.
    Thank you so much for any help that you can provide.

    • Hollywil says:

      Let me try that again.
      I've tried a few of the combinations posted, but it only ever changes the background for the I column, not the entire row. Also, I would like this specific formatting to begin with Cell I2, rather than I1.
      Thanks again.

    • Hi Hollywil,

      Before creating a rule, you need to select the entire rows you want to highlight for a rule to get applied to several columns rather than a single column.

      Also, when creating a rule, make sure that you select a range of cells beginning with row 2. You can use the following formulas in your rules:

      Highlight rows with "NO" value in column I:
      =$I2="NO"

      If there is a comma in column I:
      =SEARCH(",", $I2)

  66. JACK says:

    Hello Svetlana,
    I want to get the next cell in my row to have a specific color highlight depending on my current cell having a date or number or text. I want a different color for each type of entry. I am a novice and have researched much. I have found the best info here but i still cant figure it out.
    Any guidance would be appreciated.
    Thank you,

  67. Roy says:

    I column that contain numbers ranging from -001 to -374.

    I want to have a cell that if I type in a matching number to any of the -001 to -374, then the row containing the matched number will be highlighted.
    Please can you help.

  68. Julie says:

    your blog has helped me so much but I just need a bit more help, I am using the following formula to shade a whole row green once the word 'completed' has been added to cell M but I would really like this to be a 'date' rather than the word 'completed', I have tried a few things but I am a beginner on excel. The formula I am using is =$M2="COMPLETED" is there an easy way to change this to a date? thanks in advance

  69. Julie says:

    Thanks for your help Svetlana, that is almost perfest but I want the formula to work whatever date I put in column M, is it possible? :-)

    • Julie,

      Of course, it's possible. In this case, the formula is even simpler :)

      To color a row if a cell in column M is not empty (contains any value - number, date or text):
      =$M2<>""

      To color a row if a cell in column M is a number or date (dates are stored as serial numbers in Excel), but do not color a row if column M contains a text value:
      =ISNUMBER($M2)

  70. Bob says:

    Thanks for answering all of our questions!

    I have a problem with using this formula.

    I have 9 columns A to J

    i'd like to have a row changed to a specific colour depending on the contents of the cell in column C

    C has two states, 'INSTALLED' and 'REMOVED'

    essentially if the cell reads 'REMOVED' then i want that row to be colored yellow. If it reads 'INSTALLED' i want it colored green.

    It seemed like you already covered this in the article but your process did not work for me. I even tried adding new test rows and changing the value of the cell in column C but there was no change.

    The formulae i used were "=$C="REMOVED" and "=$C=INSTALLED"

    Thanks for your help!

  71. Ganesh says:

    I have a data with Columns; Entry No, Date, Activity, Target Date, and Completion Status.
    I want My rows color to change based on Target Date and Completion Status.
    if Target date is within 7 days row colour must be Orange.
    if Target date is due row colour must be red.
    If Completion status is completed row colour must be Green
    pls hlp me

  72. Karan says:

    Hey Admin. Hoping you could help me out here.
    In my excel sheet i have columns for start date, number of months and end date. If the number of months is 7, 2 columns, i.e column D and E must get highlighted. If number of months is 3, columns D,E and F must be highlighted. How can i do this. Please help.

  73. Farhat says:

    Hi,

    I am having trouble changing cell colours for some reason. I have used the formulas as suggested but the formula will not work. I'm not sure what I am doing wrong! I want to change the colour of the cells in the L column if they are blank and if the cells in the W column have been entered as 'No'. I have entered the formula as =AND(L2="",W2="No"). Could you tell me what I am doing wrong as I cannot work it out?

    Many thanks

  74. justin says:

    Hi Admin

    What i want is really very simple but im having trouble.
    i have 6 colums 2A to 2F i want all the background colours red there will be a number in colum 2A and 3A and when i put a number in colum 4A i want all colums 2A to 2F to change to gree ?

    Regards
    justin

  75. P suresh says:

    Hi admin

    how to highlighted condtional formatting color col A number above col B also colour not updated 0.

    Regards

    SP

  76. Karl says:

    I would like to be able to change a row to a colour if the cell G2 contains "A" to yellow "B" to green and "C" to red. I would like to continue this in all rows of column G. My issue is I can do this for row 2 but when I try to do it for the column G when I put text in 'G2' it changes all other rows.
    Will I have to create a macro?

    • Hi Karl,

      A macro is not needed in this case, the task can be handled by a conditional formatting rule. The key point is to use proper cell references - absolute column and relative row: =$G2="A"

      Also, make sure you apply the rule to a range beginning with the same row as referenced in the formula, row 2 in your case.

  77. P suresh says:

    Hi admin

    how to highlighted condtional formatting color row A number above row B also colour not updated 0.

    Regards

    SP

  78. QeMe says:

    I want to highlight a CELL based on number of times its values changed.

    e.g.
    1)IF the cell value is changed '2nd TIME' it should highlight "Green".

    2)IF the cell value changes '3rd TIME', it should highlight "BLUE" and so on...

  79. Reuben says:

    I have entered a date and time in a cell and I want the cell next to it to turn green in exactly 24 hrs. How do I do this?

  80. Sam says:

    I am trying to fill an entire row a different colour depending on date(month).

    I have set up conditional formatting to give different colours in the cell containing the date using cell value, but I cannot make this stretch across the row, every formula I have tried does not work.

    How can I get around this?

  81. Usman Asif says:

    My Online Teacher :)

  82. Ashok says:

    Hi Svetlana,

    I have an excel file which is shared between 4 people and conditional formatting doesnt work on a share file.
    What would you recommend?
    I want to change the color of a row from E4:G4 if the text value of Cell I4 is "Done".

    Thanks,

  83. Rzak says:

    Hi Dear,

    Is there any way to highlight number of cells based on entering a number on first cell for instance; i enter number 10 and automatically it highlights 10 cells ahead?

    Thanking you in advance

  84. Karyn says:

    Hi Svetlana,
    I was looking for a way to visually separate rows by category with color, I have 1-3 rows in a row that can be the same category. As if I could control the banded color of a table based on a variable - So the best I came up with was identifying whether the variable was new or the same as the last row, so there is one variable that just says "New" or "Same". I am trying to get all the "New" rows one color and all the "Same" another color. I am having trouble with the formula to highlight the whole row based on cell text, it only wants to highlight the cell or it highlights every row. The formulas are =$E$2="New" and =$E$2="Same" applied it to the whole range but it doesn't work. Am I missing a step? Or is there a better way to visually separate by a variable for viewing purposes?

    Thanks!

  85. Hannah Molloy says:

    Hi,
    I’m not sure if this is still open for questions but if so, I would really appreciate your help.
    In column A I have a list of sites. In column B I have a set of random dates which highlight the day in which these sites had been uploaded to the excel sheet. In columns C,D and E I have names (E.G C; John, D; David, E; Sam). These last three columns also have drop down menus with an option which needs to be selected for each site row. If any individual has not selected an option from the list when Column B had passed 5 days I need each of the name columns to turn orange. If the date passes 10 days I need the name cells for that row to turn RED. Is this possible with conditional formatting? I have seen this done previously but the sheet had been deleted so I am unable to copy formula. Can you please help?
    Thanks!

  86. lingamurthy says:

    helo guys,

    I need a help on excel where i have 500 id numbers in duplicates. like

    Id subject grade
    1001 xxxx

  87. lingamurthy says:

    helo guys,

    I need a help on excel where i have 500 id numbers in duplicates. like

    Id subject grade
    1001 xxxx A
    1001 YYYY A
    1002 XXXX B
    1002 YYYY EX
    1001 ZZZZ B

    i have data like above. Here what I need is, want to highlight id column with different colors. Id should get same color even if i have duplicate data in workbook. Please help me out on this. Thanks in advance.

  88. Boniface says:

    I am trying out this example on my Excel 2013 and I get an error that "we found a problem with this formula.."
    I have defined a rule with the formula below:
    =OR($D2="Due in 1 days",$D2="Due in 7 days")

    • Hello Boniface,

      Most likely the problem is in a different List Separator. This formula is written with a comma, which is the default List Separator in North America and some other countries. In European countries the comma is reserved as the Decimal Symbol and the List Separator is set to semicolon. So, try replacing "," with ";" like this:

      =OR($D2="Due in 1 days";$D2="Due in 7 days")

  89. Valeria says:

    Hi Svetlana,

    thank ypu very much for your post. Really useful. I just have the problem that saving and reopening the file,it doesn't keep the conditional formatting set. Do you know whay it might be?

    Thank you very much in advance,
    Valeria

  90. farid says:

    Hi Svetlana,

    Im having some problem. Let say my table is as follow:

    A B C D E F G
    1 2 3 4 5
    6 7 8 9 10

    I want to change the cell's colour based on the other cell value, for example:

    A B
    1 DONE
    2 NOT
    3 DONE
    4 DONE
    5 DONE

    If the word in column B is 'done", the cell 1 in the upper table will turn blue, let say. How to do it? The sequence of the numbers in upper table also not in order. It involve a lot of numbers and im not able to do it cell by cell. Please help me..

  91. Derrick says:

    I'm trying to make a cell match the color of another cell. I want A2 to match K2 (which is a date) the same color. K2 is formatted to change to red when it is 90 days out from today.

  92. Steve says:

    Hi Svetlana,
    I am trying to conditionally format a row of numbers based on a manually entered number in cell c4 my data is from cell A11 to I39 for ex if I enter a random number between 10 & 24 in cell C4 I would like the corresponding row to be a different color, I have managed to do this but it will only format the FIXED numbers from A11 to A39. Thanks in advance for any help you can give me its driving me crazy..

  93. Pam says:

    What formula would I use, if I want the text of a row to be red if one particular cell is blank and another is not blank in said row.

  94. Vijay Kshirsagar says:

    Hi,
    I am trying to conditionally format a row which is reference another cell.
    EX - IF A1 is some number like(1/2/3/4) & B1 is YES/NO.
    if in A1(1)=B1(No) then A1 become condition by color & if Yes another color.
    Help

  95. excel toy says:

    Hello All,

    i am facing one issue:

    suppose in a row, there is one box with green color.

    what formula should i use for this to know that in row we have different color?

  96. Ben says:

    You have saved Preston. Thank you.

  97. Dean says:

    Hi There, Can someone please help me with a conditional formatting to change a whole line colour based upon whether its Saturday or Sunday.

    I am using =E12+1 where E12 is a date 01/01/16 to have my cell look like this Saturday, 2 January 2016

    I had supposed using =SEARCH("Saturday",$E13)>0 to change the whole line but obviously the formula for dating does not contain "Saturday"

  98. Paige says:

    Hi, I am trying to conditionally format cells in one column based on overdue dates in another column. Specifically, I want cells in column A to turn red if the date in column P (corresponding row) is past due. When I set my conditional formatting for column A, this is the formula I have inputted: =$P2=TODAY . I also want to set up a second rule for due dates 90 days out, where the corresponding row in A turns blue. This is the formula I have inputted for this conditional format: =$P2<TODAY+90 . Neither format is working however, so I know I'm doing something wrong. Can you point me in the right direction? Thank you!

  99. Kasu says:

    Hi,

    1-3,7-9,13-15 till last row how can change "Bold" in VBA
    4-6,10-12,16-18 till last row how can change "Italic" in VBA

    Please give me suggestions.

  100. Sam says:

    Hi,
    I want to colour my bar chart "bars" based on the text written inside the bar chart "bars". ( ie if "A" is written in first bar- the bar colour should turn to red, if "B", then blue and so on), the text in the bar is dynamic and changes with the data.
    Can you please advise.
    Thanks
    Sam

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