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
by Svetlana Cheusheva, updated on
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 13. Total comments: 546
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
Thank you very much for your kind words, Gary! Nice to know my article has been helpful.
What if I want to color an entire row with a cell that containing a specific text
Hi Lulu,
This is exactly what this tutorial is about - how to highlight the entire row based on a value in one cell. The following section provides a few example of formulas for text values:
Change a row's color based on a text value in a cell
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.
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...
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?
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?
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
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.
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.
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.
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.
If suppose change the particular cell value from 5 to 3 etc.. now need to highlight color wherever we changed value
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?
Wow, thanks a lot for those tips, it will help a lot!!!
THanks alot it helped!!
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.
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
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"
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.
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.
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
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.
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
Hi Shikha,
I think you can try filtering the column by color as explained in this article - How to filter cells by color in Excel and then copy the filtered cells.
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".
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.
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!
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.
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
Hi Jal,
You can do this by creating 2 conditional formatting rules for Column B with these simple formulas (where 2 is your 1st row with data):
Green: =$B2>$A2
Red: =$B2<$A2
You can find more formula examples in this article - Excel formulas for conditional formatting based on another cell.
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.
Hi Jelena,
I've added a solution to my Icon Set article, please check out Example 2 - How to add icons based on another cell's value.
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.
Hi Marina,
I think this can be done only via a macro. Regrettably, there are no such rules in Excel conditional formatting.
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
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:

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
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.
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
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.
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
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.
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.
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.
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.
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.
Great tutorial. Is very helpful and saved my time lot. Thank you.
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!
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.
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.
Hi Josh,
You just need to create one more rule for the same range with this formula =TODAY()=$C1
How do I get an icon set to plot on a graph based on data results from a survey?
Sorry, I do not exactly understand what you are trying to achieve. Please send us (alexander.frolov@ablebits.com) a screenshot of the desired result and your sample data and we will try to figure out a way.
okay i got it... Its in the font tab while creating the rule.
Exactly! : )
Hi,
If i want to change the font color based on cell color what should i do
Hi Svetlana,
I got it to work. Thank you very much
Hi Svetlana,
I still can't seem to get it right. Maybe I should explain better. I have text in column C and then have values in some of the other columns. my text in column C reads "PC AMOUNT" and when I type this in I want the specific row from column A to Column G to turn a specific colour.
When I use the formula you gave, and I type in "PC AMOUNT" where "text" is, it gives me an error. " you may not use reference operators "
Can you perhaps assist.
Thank you
Hi,
I have tried to create a rule with this formula =$C2="PC AMOUNT" and it worked fine on my test data. Just make sure that you use the straight quotes in Excel, because this blog converts them to smart quotes and this does cause the error you mentioned when copying/pasting formulas directly.
Hi, I am struggling with the following:
I have a certain text in Column C and want that certain row from A to G to be a specific colour when the text is written in column C. can you please help me?
thank you
Hi,
If you want to highlight the row with exact match in Column C, then select your table and create a rule with this formula:
=$C2="text" (assuming that your table has headers and row 2 is your 1st row with data)
If you want to highlight the row with partial match, i.e. Column C may contain a certain text preceded or followed by some other text, then use this formula:
=SEARCH("text", $C2)>0
Hi Svetlana
I used VLOOKUP function to fetch the desired row and show it elsewhere and it works.
I hope can find a solution for my 2nd Q. I think i should use some codes in excel VBA. Unfortunately I have no idea about that.
Hi Morteza,
To my best knowledge, it is not possible to display a certain row as a pop-up in Excel, at least I do not know any means to achieve this. I am really sorry.
I made a table which uses a simple formula to calculate the profit of deposit money then shows the result. Each row stands for a day.And now, i want the row of containing current day result can be shown on screen automatically (something like a pop up message)when I logs in to my account.and afterward by clicking a button or icon whenever I wish. In summary I WANT A ROW OF DATA IN EXCEL 2007 BE SHOWN ON DESKTOP LIKE A POP UP WINDOW AT START UP.I hope I explained it clearly.
THANKS
Hi all,
How to send a specific excel data as a pop up message on desktop by these rules:
1- Auto pop up at start up
2- By user click
3- contents data varies based on computer current date.
Does anybody know How?
Thanks
It is very difficult or probably impossible to display a pop-up on desktop. You can get the dialog to appear in Excel upon opening a workbook and /or clicking a button in the workbook. The question is what exactly you want to write in that dialog?
Hi Svetlana
At first i should thank you for your helpful advice to clear my mind about some problems.
But now,i encounter another problem and hope i can describe it well.
1- I made a table that calculates the benefit of a deposit money then shows it in a cell(all in a row).It also highlights the row of current day "today()" nfo.
Since it has too many rows it takes time to find the right one, so i want to show the exact data based on current day in different place for example at the top of the sheet.
2- Is it possible to show this new row on screen when a user log-in. (something like pop up text ).
Thanks for your hints even if it doesn,t solve my pb.
Hello Morteza,
Thank you very much for your kind words! Regrettably, I do now know a way to show a certain row at the top of the sheet. Really sorry for not being able to help you.
Hi Svetlana
Thank you for you good work.
How do you change the color of a value in a cell that has changing (RTD) dynamic value:
Example:
Cell A1 contents 1000 Text color is BLACK time 00:01
Cell A1 contents 1001 Text color is GREEN time 00:02
Cell A1 contents 999 text color is RED time 00:03
Thank you
Ian
Hi Ian,
You can try to do this by creating 3 different rules of the type "Format only cells that contain" that apply to the entire table. Please see this example for step-by-step instructions: How to change a cell's color based on value.
Though, I have to say I have never tested the conditional formatting rules on data returned by an RTD and cannot say with confidence whether this will work.
thnx alot. this was very helpfull
Hi Svetlana,
how to highlight first order row of every client? My spreadsheet contains client name, date of acquisition columns and has many entries per client.
Many thanks!
Hi Marcel,
I cannot figure out a way to do this with conditional formatting. However, our Duplicate Remover add-in can help. You can download a trial version and then do the following:
1. Select your entire table, and click "Duplicate Remover" icon on the ribbon, then click Next.
2. Choose to find "Uniques +1st occurrence".
3. Select only your "Client ID" column as the key column.
4. Select the action "Fill with color", choose a color and click Finish.
The first order row of every client will be shaded with the color of your choosing. Is this what you are looking for?
Hi Svetlana,
I cannot set a conditional (color) format in (say) cell A1 based on A2 if A2 is a formula. If I type in a hard number into A2 then A1 goes red - it works fine - but when I put the formula back into A2(which delivers the correct answer itself for my spreadsheet)then A1 does not respond ?
Please help.
Many thanks
Owen
Hi Owen,
In theory, this should work with formulas too, unless you use something very specific. Could you give an example of your real formula, probably this will give me a clue?
Hi svetlana,
Have another query. Its related to Macro. I have two different work sheets. from the first sheet i have to copy two separate cells and have to paste that in the second sheet. after i paste i will get values generated in the second sheet. then i have to copy the generated values and paste it in the first sheet. this has to keep on goin on a loop. how to do this.
For example from first sheet i will copy distance and speed and paste in the second sheet. based on these values cost will be automatically generated in the first sheet. and then i have to copy these costs and paste in the first sheet. Then i have to copy next two values of distance and speed from sheet 1 and paste in sheet 2. this has to go as a loop.And the sheets should automatically open.
Chris
Hi Chris,
Sorry, I do not know a solution for this. Maybe you will be able to find the answer on these 2 forums:
https://www.excelforum.com/excel-programming-vba-macros/
https://www.mrexcel.com/forum/excel-questions/
thank you..
Hai Svetlana,
Thanks for your reply. Second part worked perfectly. But for the first part when i say start date as 20/03/2014 and duration as 2 days then it should consider 20th also. so the end date should be 21/03/2014.
Cheers
Chris
Hi Chris,
In this case, the correct formula is this =WORKDAY.INTL(A1-1,B1,7)
However, please note that if your start date as 20/03/2014 and duration as 2 days, the end date will still be 23th because March 21 and 22 are Fri and Sat, respectively, and they are days off according to your requirements.
Hi. Thank you for the helpful instructions. I am trying to set the color of a row based on the text in one column, but have a list of words to exclude.
Therefore, I want the rows where certain words do not appear in a specific column to be highlighted. I would greatly appreciate your help.
I have tried the following formula without success
=AND($F17"BLUE", "RED")
and
=OR($F17"BLUE", "RED")
Hi Abby,
If my understanding is correct, you need to highlight rows where neither "BLUE" nor "RED" appears in column F. If so, select your entire table and you can use create a conditional formatting rule with this formula (assuming that your table has headers and row 2 is your 1st row with data):
=AND($F2<>"RED",$F2<>"BLUE")
If you want to highlighted rows that contain certain words, let's name them "GooodWord1" and "GooodWord2", but do not contain words-exceptions, say "ExcludeWord1" and "ExcludeWord2", then you will need a very complex formula like this:
AND(false=ISERR(SEARCH("GooodWord1",$F2)), false=ISERR(SEARCH("GooodWord1",$F2)), true=ISERR(SEARCH("ExcludeWord1",$F2)),, true=ISERR(SEARCH("ExcludeWord2",$F2)))=true
As you see this formula is very long and that is why your workbook may start working a bit slower than usually.
How to use Conditional Formatting in total Row Like
Name Age City
Jaslok 20 Delhi
Ramesh 21 Jabalpur
Rama 22 Kanpur
Hi Pratap,
It depends on what exactly you want to do. If you can give me some more details about your task, I'll probably be able to help.