This tutorial explains how to use Excel formulas to format cells and entire rows based on the values you specify or based on another cell's value, and provides a handful of formula examples. Continue reading
by Svetlana Cheusheva, updated on
This tutorial explains how to use Excel formulas to format cells and entire rows based on the values you specify or based on another cell's value, and provides a handful of formula examples. Continue reading
Comments page 43. Total comments: 1726
sorry, formatting went wrong, hope you can read it
for every space there should be a tab.
Hi, thanks for the helpful posts. Though I am struggling with the following:
I want to color column B depending on column A. And result columns (say E to X) should be dependent on B (it's like a matrix of column B). My guess is I mix up relative and absolute cell-links. Or I don't get how to copy the rule for a cell to others, i.e. I can create the rule for a single cell, but not the full column.
A B ... E F G .... X
Positive 44 =B1 =B2 =B3 ....
Positive 43 =B13 =B14 =B15 ....
Negative 40
Positive 50
Uncertain 42
Positive 49
Negative 20
.... ...
Very greatfull for any tips or solutions.
I'm using Excel 2013. I have not found a solution to this problem. I have a spreadsheet with 100 rows. The values in column P are numbers that are independent of each other. They range in value from 1.00 to 60.00. The values in column O range from 0.00 up to the value in column P for that row. I want to have each cell in column O in my worksheet use a red-yellow-green color scale conditional format, where the low value is zero, the middle value is one-half the value in column P for that row, and the high value is the value in column P for that row. I can create this conditional format for any one row easy enough. I can't find any way to copy it to the other 99 rows because the cell references in the color scale conditional format need to be absolute. It would be a lot of manual work to create this conditional format for each row one at a time. Is there a lower-effort mechanism available to do this?
in my worksheet, i have two columns, one is alphabet (column B) and the other one is numeric (Column C).
my condition is:
if column B is L, then column C should be 1
if column B is V, then column C should be 2
if column B is T, then column C should be 3
I WANT TO SATISFY THIS THREE CONDITIONS IN A SINGLE FORMULA, IS IT POSSIBLE?
PLS GUIDE ME
Oops the table didn't appear as it should be...
Hello,
I have a workbook in excel and I want to know what article/type/value which is clicked or typed frequently in excel. But, I don't know how. can you help me?
Thanks :)
Hello,
I have a workbook in excel and I want to know what article/type/value which is clicked or typed frequently in excel. But, I don't know how. can you help me?
Thanks :)
Hi,
I want to format a column of cells to fill in depending on when a specified date in another column has passed. For example I input the date into column "b" and then Seven days after that date has passed, I want Columns D,E,F to fill green. I am having trouble creating a formula depending on a date, any help offered would be appreciated.
Thanks!
Hi,
I want to format a column of percentages, dependent on the column of percentages to the left of them.
Highlight in green if the value is between 2% and -2%
Highlight in amber if the value is between 2% and 4%, and -2% and -4%
Highlight in red if the value is above 4%, or below -4%
I'm sure this is easy, but i cannot get my head round it. I think it could be to do with how the rules are ordered in the manage rules section, but not sure.
Thanks.
Oops the table didn't appear as supposed;
Output 1 Output 2 Addition to column B
260,1 201,123 b2
262,1 242,105 y4-NH3+2
330,2 250,618 y4+2
338,1 269,161 y2
351,1 306,134 y5-H2O+2
372,1 306,625 y5-NH3+2
372,8 315,139 y5+2
416,1 320,197 a3
418,1 330,181 b3-H2O
348,192 b3
370,655 y6-H2O+2
371,147 y6-NH3+2
372,170 y3
379,660 y6+2
417,213 a4-NH3
427,197 y7-H2O+2
427,689 y7-NH3+2
434,240 a4
436,202 y7+2
444,224 b4-H2O
Hi there,
I'm trying to compare column A with a table, for example column B and if there is a match the match should be colored. Column B contains a output that had several decimals. The match does not need to be exact, ideally I would like to scan for a range of about +/-0.5 of column B. Does anyone have a suggestion how to approach this?
ColumnA ColumnB ColumnC
Output1 Output2 Addition to column B
260,1 201,123 b2
262,1 242,105 y4-NH3+2
330,2 250,618 y4+2
338,1 269,161 y2
351,1 306,134 y5-H2O+2
372,1 306,625 y5-NH3+2
372,8 315,139 y5+2
416,1 320,197 a3
418,1 330,181 b3-H2O
348,192 b3
370,655 y6-H2O+2
371,147 y6-NH3+2
372,170 y3
379,660 y6+2
417,213 a4-NH3
427,197 y7-H2O+2
427,689 y7-NH3+2
434,240 a4
436,202 y7+2
444,224 b4-H2O
For example 330.2 matches 330,181 (with addition b3-H2O)and so they should be filled in with red. 372.1 matches with 372,170 and thus y3, the should be colored orange etc.
Look forward to any help,
Thanks, regards,
G
Oops the table didn't appear as it should be..
Hmm the table didn't come out as it supposed to..
Output 1 Output 2 Addition to column B
260,1 201,123 b2
262,1 242,105 y4-NH3+2
330,2 250,618 y4+2
338,1 269,161 y2
351,1 306,134 y5-H2O+2
372,1 306,625 y5-NH3+2
372,8 315,139 y5+2
416,1 320,197 a3
418,1 330,181 b3-H2O
348,192 b3
370,655 y6-H2O+2
371,147 y6-NH3+2
372,170 y3
379,660 y6+2
417,213 a4-NH3
427,197 y7-H2O+2
427,689 y7-NH3+2
434,240 a4
436,202 y7+2
444,224 b4-H2O
Output 1 Output 2 Addition to column B
260,1 201,123 b2
262,1 242,105 y4-NH3+2
330,2 250,618 y4+2
338,1 269,161 y2
351,1 306,134 y5-H2O+2
372,1 306,625 y5-NH3+2
372,8 315,139 y5+2
416,1 320,197 a3
418,1 330,181 b3-H2O
348,192 b3
370,655 y6-H2O+2
371,147 y6-NH3+2
372,170 y3
379,660 y6+2
417,213 a4-NH3
427,197 y7-H2O+2
427,689 y7-NH3+2
434,240 a4
436,202 y7+2
444,224 b4-H2O
Is it possible to give a colum like "stable" or "ascending" the directional icons?
Like if stays "stable" then must be ↔ and for "ascending" ↑.
I i want use now the directional icons, i must give a number. I want in text.
I solved this problem with using VLookup
Please help me, I have a spreadsheet,eg A1:P245, I would like to be able to do is delete/clear any cells that contains a particular text.
For example the cells may contain the following data
P1abc P1gvh p2erg P3fgh sro34 sro56 srj67
How do I clear the cell that start with P
How do i clear the cells that contains ro
Thanks you.
I have text from a drop down list (NO and YES) in Cell B2 that I want to use as the basis for conditional formatting elsewhere in the spreadsheet (to color a number of cells in a certain row red), but the formula (=$b2="YES") does not seem to recognize the text - if I insert the text manually rather than use the drop down list it works just fine. Any suggestions?
Thank you.
Hi..
I want to change a entire row color for a cell value of the row... If i have 'fail' in a certain cell (D1) then i want to highlight row 1. How can I do that?
Hi Nazmul,
Simply select all the rows you want to highlight and create a rule with this formula:
=$D1="fail"
Hi Svetlana,
Thanks a lot..it works..
Hi Svetlana,
I am trying to do conditional formatting of email addresses to quickly identify addresses from gmail, hotmail, and yahoo. After a lot of looking online, I found a formula I could use:
=NOT(ISERR(SEARCH(Sheet2!$A1:$A3,A1)))
(Sheet 2 A1 - A3 are: A1= gmail.com, A2= hotmail.com, A3 = yahoo.com)
However, when I put this in my conditional formatting - it only highlights those addresses with gmail in them and ignores the rest. I'm not sure what I am doing wrong. Any ideas?
-Michael
Hi Michael,
The point is that you have an array formula and array formulas can't be used in conditional formatting rules. In your case, the formula turns into =NOT(ISERR(SEARCH(Sheet2!$A1,A1))) and highlights only gmail addresses.
You can pick the domain name in a row and use the MATCH function to find matches in your lookup table using the following formula:
=MATCH(IFERROR(RIGHT(A1,LEN(A1)-FIND("@",A1)),""),Sheet2!$A$1:$A$3,0)>=1
You rock my world. Remind to me buy you a beer if we ever meet. :)
How do I conditionally format a table so that in column J when the word "Complete" is entered it highlights rows C to J in green?
Hi Svetlana, Great blog here!
I think my problem is quite simple, and may have been covered in earlier examples but I am still unclear through trying!?
I have a value of "Yes" or "No" in Column F, and want to colour this column/these cells based on a date in the same row, Column D:
Amber: If 30 days overdue i.e. <NOW()-30
Red: If 60 days overdue i.e. <NOW()-60
Can you help??
Many thanks!
Ashley
...oops forgot to say, I wish to colour it when it says "Yes". "No" should be left unformatted
Hi Ashley,
You can combine these 2 conditions using the AND function, like this:
Red: =AND(TODAY()-$D2>60, $F2="yes")
Amber: =AND(TODAY()-$D2>30, $F2="yes")
Please note that the Red rule shall come first in the list of rules.
Great, that works a treat. Thank you for your timely help :)
Hi Svetlana
I am trying to change the cell colour of rows based on the change in value. Similar to Subtotal.... for each change in column B....
so if I have
1
1
1
2
3
3
3
3
I would like the colour for Rows 1 - 3 to be red, then white for 4th row then red for row 5 - 8
Is it possible?
Thanks
Hello,
I am trying to format a cell if it is greater than another cell. Basically if the result is greater than the criteria?
Criteria Results
0.7 0.220 0.213 0.555 3.240
5 0.800 0.064 0.324 0.585
Any help on why this formula isnt working??
=AND(ISNUMBER(B2),ISNUMBER($A2),B2>$A2)
Where Cell A is the criteria and B is the result
Thanks,
if i have one date, that date is smaller than other date. for this which formula i can use
Sir,
I am having spreadsheet containing D cell value K cell value , what is the formula for if K value is not equal to D cell value ?
Please reply.
K.R. Ranganath
Hi Ranganath,
Assuming that row 2 is your first row with date, here's the formula:
=K2<>D2
Hi there,
I don't know if you can help me but it's worth a try! I am looking for a conditional formatting formula that will help me do the following...
If cell A1 is a colour (i.e. determined by conditional formatting rules) then make another cell the same colour without changing the original function in the second cell.
Thanks!
Ian.
Hello
If I want to write a conditional formatting that for example it should find for me if the fifth number in a certain cell is 0 then make the cell red
12340
or1,2340
how do I write it
hi
if i have two dates on one cell. i need to change the color if the send date added
i mean 2nd date added
HI,
I want to color a cell based on another cell value.
if cell D1 contains "false" I want to get red color in cell A1.
How can i do that?
Thanks
Nazmul
Hi Nazmul,
Simply select entire rows and create a conditional formatting rule using the same formula.
Hi Nazmul,
If FALSE is entered in D1 as a logical value (Boolean), then you can create a rule for cell A1 (or multiple cells in column A) with the formula: =D1=false
If you have "false" as a usual text, then enclose it in double quotes in the formula:
=D1="false"
Hi Svetlana,
Thanks..it works.
I have another problem. I want to change a row color for a cell value of those row..How can I do that?
Nazmul
Is it possible to include multiple conditions using both AND and OR operators in the formula for conditional formatting. Can you please provide a syntax for this.?
Thank you in advance!
Hello Ahamed,
Of course, it is possible. One an AND function can be one of the conditions in the OR function and vice versa. For example:
=AND(B1=2,OR(C1=3,C1=4))
=OR(AND(B1=2,C1=3),C1=5)
HI,
I have a spreadsheet for cashflow that tracks down my everyday expenses. On another tab, i have a consolidated tracker that includes my businesses and investments. The problem is i keep on substituting a certain entry in the consolidated tracker because i dont know how to reflect the latest cash i have base on the cash flow tab as of the current date. Here is the example:
Cell A Cell B
20Nov14 $500
21Nov14 $400
22Nov14 $350
23Nov14 $100
cash as of today: ????
I wanted excel to always pickup the cash based on the current date. Let's say today is 23Nov14.
Thanks,
Ben
Hi Ben,
Please clarify what exactly result you want to get: expenses for 23-Nov-14 ($100), a sum for the previous days in November or something else?
Hi,
I have a formula for my sheet with vlookup..for ex:In the cell A2 if i type "Apple" than the rest of the cells in the row gets filled up automatically like B2 with "fruit"
C2 with"Red".But if SOMEONE TRIES TO CHANGE THE FORMULA for ex.. enter something other than the "fruit" in B2 or other than "Red" in C2 the color of the particular cell should change to red and No fill when they change the values back to formula...
Thank you very much in advance!
The techniques you outlined work great unless you have data in merged cells. My "applied to" cells are merged. It appears that the formatting chosen in the merge dominates the conditional formatting. If I set up my conditional formatting, then double click in the cell, I can see the result of the conditional format, however as soon as I leave the cell, the formatting is gone. Any way to remedy this?
Hi,
Can you help me please?
If cell A1 = 1, I want the maximum value in the range B1:B5 to be highlighted red. If cell A1 doesn't = 1 then no conditional formatting needs to take place.
Any ideas?
Hello Andy,
Select the cells B1:B5 and create a rule using this formula:
=AND($A$1=1,Max($B$1:$B$5)=B5)
This worked:
Select range B1:B5.
Conditional Formatting > New Rule.
>Format only cells that contain.
Cell Value > equal to > =IF($A$1=1,MAX($B$1:$B$5))
Format > Fill > Red.
Hi, I want to apply conditional formatting for "not equal to" clause. The cell is getting highlighted if I choose from the provided options like equal, greater than but not getting highlighted if I manually enter a formula for not equal to. Im using this formula : =$D25490
Thanks !
$D25490
Hi!
This formula does not look correct (maybe was distorted when publishing). Anyway, if you can specify what exactly cell(s) you want to highlight and based on what exactly condition (not equal to a certain number or another cell?), I think I will be able to suggest the right formula.
The not equal to operator did not get published! Anyways, I have a column named cost code under which I want to highlight all the values which are not equal to 5490.
Our blog engine often cuts off the "not equal to operator" in comments, argh! Anyway, your formula (=$D2<>5490) is correct. Just make sure you are selecting the entire cost code column (without the column header!) when creating the rule, and row 2 is your first row with data.
If the rule still does not work for you, you can send me your sample worksheet (support@ablebits.com) and we'll try to figure this thing out.
I have a pivot with conditional formatting. I now need to add more columns of data to the pivot. When I do that the column references called out in the conditional formatting don't change and I lose the formatting.Is there a way to do this without losing the formatting?
Hello Alex,
I am sorry, it is difficult to recommend anything without seeing your data. If you can send your sample workbook to support@ablebits.com pointing out the column you want to add, our support team will try to help.
Hi,
For this task, you need a usual IF function rather than conditional formatting. For example, these are the formulas for cell B3:
=IF(B2="yes",Sheet2!B3,"")
=IF(B2="no",Sheet3!B3,"")
Hi,
I need to edit / fill cells if a certain cell in the row contains 'Yes' or 'No' with the contents of cells from another sheet.
For example,
On Sheet1, If B2 = 'Yes' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet2.
And on sheet1, if B2 = 'No' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet3.
How do I manage this, I have been trying all day!
Thank you in advance for any help you can give...
Hi
I am trying to figure out a formula that will identify the same number within a column, and within that range compare the sums of 2 other columns to see if they are equal, with an output of anything ("same", colour whatever) or to just be left alone if the sums don't add up.
Example:
Invoice # Dr Cr
111 14 0
111 0 12
111 0 2
222 4 0
222 0 3
would result in
SOMETHING
SOMETHING
SOMETHING
222 4 0
222 0 3
Is this possible?
I have over 26,000 lines of data that need to be identified by an invoice # if the Dr don't equal the Cr...please tell me there is a way!!
Hi Svetlana
Great source of information. I came across it searching for a solution to a problem I have. In one column (say column 'A') I have a list of activities that need to be completed. In another column (say column 'B') I enter the percentage of the task in column 'A' that has been completed. I would like the first column to be filled with a data bar based on the percentage that has been entered in column 'B'. Probably dead easy but I can't figure it out. Be really great if you can help.
Thanks
Shaun
Hi Shaun,
Unfortunately, it is not possible to fulfill your task using Data bar, or at least we don't know how. Data bar works only with the information in the same cell.
The only alternative we can suggest is to insert a helper column to the left or to the right of column A, enter the formula =$C2 there and copy it down to other cells. Then you can apply a conditional formatting rule to this column by selecting the Data Bar format style and turning on the "Show bar only" option.
I am attempting to write a conditional format that allows me to see when the value in one cell is larger than another, then shade the larger cell darker as the difference becomes greater.
A1 = 95
A2 = 96
In the above example, A2 is larger and would become filled with a color,the difference is 1. But if the difference were 5 (A2 = 100) then I would want cell A2 to fill a darker shade.
I tried using standard deviation and color scales, but because there are only 2 number being compared, it does not seem to work the way I had hoped.
Thank you for any advice you may have!
Gary
Hello Gary,
I am sorry, I don't know a way to fulfill your task using Color Scales. As an alternative, you can try creating several rules based on formulas:
=AND(A2-A1>=0, A2-A1<=2)
=AND(A2-A1>=2, A2-A1<=5)
=AND(A2-A1>=5, A2-A1<=10)
Hi,
I was having the same issue and I manage to solve it using Color Scales. :)
Try the following:
- Select the range (a1:a2 in your example) and enter in the Conditional formating > New Rule > Format all cells based on their values
- Select 3-Color Scale
- In the "Minimum", select Type "Formula" and write the following formula: "=MIN($A$1:$A$2;1)"
- Let the Midpoint with the percentile
- In the "Maximum", select Type "Formula" and write the following formula: "=MAX($A$1:$A$2;100)"
The further the diference between the values of the cells, considering a potential maximum of 100 and minimum of 1, the darker de cell color.
Hope this helps.
Cheers.
Hi,
I need to edit / fill cells if a certain cell in the row contains 'Yes' or 'No' with the contents of cells from another sheet.
For example,
On Sheet1, If B2 = 'Yes' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet2.
And on sheet1, if B2 = 'No' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet3.
How do I manage this, I have been trying all day!
Thank you in advance for any help you can give.
How can I set a conditional format, that will highlight a cell that changes in value upon refreshing its data load?
I have a spreadsheet with about 5000 rows. One of the columns is "File Status" that is filled with either a "A" (for active) or "C" (for closed). Is there a way to move a whole row based on that column to a new worksheet. Ideally, we would work from the worksheet with all the "A" files and when we close the file, we change the "A" to a "C" and the whole row could be moved to the sheet for Closed files. Also, if we reopen a file, is there a way to put on the Closed sheet a formula to move "A" files back to the original sheet?
A really good post. Thanks.
Drawing a blank.
If I want to set a condition format with an icon set where I get a "check mark" for zero and and "x" for anything greater than zero.
Seems very simple but I am not wrapping my head around it at the moment.
Hi Ben,
I have experimented a bit, and the following settings seem to work fine. Under Conditional formatting, click Icon Sets > More Rules and then set up:
X when values is >o (type - number)
"check mark" when <=o and >=0 (type - number)
X when when <o (type - number) (X will also appear for values less than zero, if any; or you can choose any other icon for this).
Hope this helps.
Hi team ,
i need to format a cell if another cell contain Yes ,
A1 contain Yes
Now I need to apply conditional formatting on B2 if A1 contain "Yes"
Hello Musadiq,
This is very easy. Simply select cell B2 and create a rule with the formula =A1="yes"
Reference: 120 80 Diagnosis
Measured: Systolic Dialatic Systolic Dialatic
Patient 1 111 75
Patient 2 105 75
Patient 3 104 80
Patient 4 126 86
Patient 5 120 69
Rule: Measured blood pressure -
- can be lower than the reference by 10 (0~10 lower are OK);
- can be higher within 5 (0~5 higher are OK)
- 11 ore more lower is diagnosed as "Lo BP"
- 6 or more higher is "Hi BP"
So the words "Hi" or "Low" wil lbe displayed
in the range of D6:E10
I need a formula for systolic using a Rule: Can you help me please
Hello Liana,
Shall we check these criteria "11 ore more lower" and "higher within 5" against both Systolic and Dialatic? Or "11 ore more lower" applies to Systolic and "higher within 5" applies to Dialatic? Also, in what columns do you have Systolic and Dialatic numbers of your patients and in what cells you have the corresponding reference numbers?
Hi Svetlana,
I have a data table and column Q is drop down list of an application status. Column P is populated with some values. My requirement is if a specific drop down value is selected from Col Q the corresponding col P value should become zero.
I have tried conditional formatting but it is throwing up circular reference issues. Can you please help?
Also, I have always admired the name Svetlana!!
Hello Subha,
It is not possible to change values in cells using conditional formatting.
You can enter the following formula in Cell, say P2, that will populate it with 0 once "Value1" is selected in cell Q2, otherwise, cell P2 will be empty.
=IF(Q2="Value1", 0, "")
If you want to change the current value in column P based on the section in your drop-down list, then a special VBA macro is needed.
Select a value from a drop down, then that selected drop down value (flags) changes a cells color on a different sheet depending on value selected from drop down.
Hello Jason,
Sorry, I don't exactly understand your task. Please describe in more detail what you want to get.
Svetlana,
Nice Work!
I want to know if is it possible to change the color of a cell when rollover another cell?
For example: if I get my mouse over the cell A1, the cell B4 change its color.
Thanks in advance.
Thank you, Carlos.
Unfortunately, I don't know the way to fulfill your task using a formula or a VBA macro. Really sorry.
Hello,
I'm trying to configure an "and" statement - I think.
I have a number of upcoming "jobs", all down column A. For each job, there are a number of "tasks", all across line 3. When a task for each job is completed, I simply put an x in the corresponding box.
My jobs all have a different start dates, and as of right now I have the estimated start date in column C. When the upcoming job starts within in 2 weeks, it highlights the cell orange using =AND(C4-TODAY()>=0,C4-TODAY()<=14). When a job has started, it highlights the cell red using =C4<TODAY().
Is there any way I can double-conditional format, where if a job is coming up within two weeks and some of the tasks for that job have not been completed, it will highlight that cell? Same with once a job has started. Thank you very much.
Hello Susan,
If my understanding is correct, you have each task in a separate column, say columns D-F. And you want to highlight a job that is coming within the next 2 weeks if _at least one_ task column is not filled with "X".
If so, you just need to embed the OR statement in your formula, like this:
=AND($C4-TODAY()>=0, $C4-TODAY()<=14, OR($D4<>"X",$E4<>"X",$F4<>"X"))
I'm trying to use conditional formatting to highlight a cell in a column red if the value of the cell is > 150% of the average of the values in the column. I've tried and tried,but nothing I have tried works. Can you please help?
Hi Brian,
Try creating a rule with this formula:
=A2>AVERAGE(A2:A20)*1.5
Where A2 is your first cell with data.