I have a 13x13 table of data on a worksheet that is comprised of links to another sheet.
For example the first row of 13 looks like:
=Sheet1!R7 =Sheet1!R20 =Sheet1!R21 =Sheet1!R22 =Sheet1!R23 =Sheet1!R24 =Sheet1!R25 =Sheet1!R26 =Sheet1!R27 =Sheet1!R28 =Sheet1!R29 =Sheet1!R30 =Sheet1!R31
I want to do conditional formatting over the entire table for when data from column R and column C of the same row are equal and >0.
For example;
When Sheet1!R7 is equal to Sheet1!C7 and >0, color the sheet 2 table (that has the link) red.
When Sheet1!R20 is equal to Sheet1!C20 and >0, color the sheet 2 table red and so on.
I would also like to repeat the process with a different colored fill if R == L and >0 but I can just use the same formula once I know how.
My attempt was =AND(Sheet1!R7=Sheet1!C7,Sheet1!C7>0).
This works for the single cell, but I'd like a way to do the whole table at once.
Any help is appreciated, thanks.
EDIT for clairty:
*I'm sure I'm not explaining it too well.
To put it simply, I have 2 columns of numbers, let's say A1:A169 and B1:B169.
I want to take the larger number from A and B for each row (A10 vs B10 etc, I used MAX function for this) and dump the output in column C.
I then aim to color code column C based on whether the number comes from column A or B. Red for A, yellow for B (no color for <0).
So far I have achieved all of this, I have the data sitting in a column color coded.
My problem comes in that I want to have the 169 numbers in column C in a more readable format, I.E. in a 13x13 grid table. I don't know how to do this and keep the color coding!*
I suppose I can offer you some possible solution.
Lets say you have sheet1 and sheet2. In sheet2, you have links to
sheet1 as you mentioned. And my understanding is that you want to color
the sheet2 (the entire table?) as red if a certain condition is met.
This is how it might be done.
In sheet 2, create a formula for a cell which reflects your condition. Lets say that is =IF(Sheet1!A1="foo", 1, 0). You can add your AND conditions in that if statement. So that cell will contain 1 if the condition is met and 0 if not met.
Select the range of cells in sheet2. Click conditional formatting. Select "use a formula to determine which cells to format". Enter the condition for the calculated value in sheet2. For example, in sheet2, my cell G1 is the result of the formula =IF(Sheet1!A1="foo", 1, 0). So if the value of G1 is 1 then I want to color the range Red.
So in essense, we are using a formula to calculate the value of a cell and using that value
as a condition to format a range of cells in Sheet2.
Hope this helps.
Related
In excel, I have the following:
I am trying to find the quickest and most user-friendly way to compare columns 2 and 1.
If a name in column 2 (in the format shown below) matches ANY of the cells in Column 1, the cell in Column 1 goes GREEN, indicating that user is PRESENT in Column 2.
I have played around with conditional formatting but would appreciate any direct and efficient solutions.
I was trying to adapt a version of this, but it failed to work:
=SUMPRODUCT(--(MID($A4&" "&$A4,FIND(",",$A4)+2,FIND(",",$A4&" "&$A4,FIND(",",$A4)+2)-FIND(",",$A4)-2)=$B$4:$B$33))
where the above formula was added on highlighting the first column and then ensuring the A4 referred to the first item in Column 1 and the B was the first and last item in column 2. As mentioned, this didn't work.
Update
Tried this as well but didn't work.
This answer written assuming column1 = column A, and column2 = column B
Apply a conditional format on column 1, set up with green background, with the formula =COUNTIF(B:B, A1)>0
Apply another conditional format on Column 1, set up with red background, formula =COUNTIF(B:B, A1)=0
Edit those formulas as necessary so that:
B:B is the address of column 2, the range you're looking in for each name
A1 is the address of the first (top-left) cell that the conditional format applies to.
You can select both columns and do Conditional Formatting, Highlight Cells, Duplicate Values. That would be the easiest way to compare. You can format the cells in the first list with red fill if you want them to be red and set the format for duplicate values with green fill. This will format it in the color scheme you showed. If the name is removed from the second column, the cell will go back to red.
Sheet1
[
Sheet2
[
On Sheet 1 I have four columns Col A= 1st adjustment, Col B= 1st Check, Col C= 2nd Adjustment, Col D= 2nd Check.
The values in these columns are either 0 or non 0. Always a number. For the two adjustment columns I format them to be Red (if they are non-zero) and for the two check columns I format them to be Yellow (if they are non-zero).
On sheet 2 there is a column that pulls and combines the the sets of adjustments and checks and assigns them to the correct employee ID #.
Somehow I need the formatting on the column in sheet 2 to be red if the number came from an adjustment column on the other page and yellow if the number came from a check column on the other page. And no color if it is equal to 0.
What is the best way to do this? I have not been able to find a solution.
The conditional formatting rules I have are all applied to column C Sheet 2. They are:
#1- Cell value equal to = 0 (no fill)
#2 Cell value equal to =Sheet1!$E1 (yellow fill)
#3 Cell value equal to =Sheet1!$C1 (yellow fill)
#4 Cell value equal to =Sheet1!$D1 (red fill)
#5 Cell value equal to =Sheet1!$B1 (red fill)
Assuming that both lists start in A1, put this formula in cell D2 of Sheet2:
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))
Then select the range C2:C13 and open the conditional formatting menu. Add 3 new rules based on formula. The first formula is:
=D2=1
and set the format as filled in red. The second formula is:
=D2=2
and set the format as filled in yellow. The third formula is:
=D2=0
and set the format as unfilled (which is not the same as no format selected). This last rule is not strictly necessary if none is going to change the format of your range manually. Still...
Note that each formula for the conditional formatting is written without any $ that would lock the reference. Therefore each cell in the range $C$2:$C$13 will translate that formula relatively to its own position. Cell C2 will "look into" cell D2, cell C3 will look into cell D3, C4 into D4 and so on. You can of course hide column D and the conditional formatting will still work.
You could also make it without using an extra column. Just edit the formula meant for cell D2 accordingly and use it in your rules. Something like this should work:
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))=1
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))=2
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))=0
Formula details (as asked in comments)
B2 is for the row. In the context of the INDEX function it says at what row of the range ($B$2:$E$7 in the formula we see here) the INDEX function has to "look". If B2 is 1, it will consider the first row of the range (in our case row 2). If it's 2, it will consider the second row (in our case row 3).
(A2-1)*2+1 stands for the column. In the context of the INDEX function it says at what column of the range ($B$2:$E$7 in the formula we see here) the INDEX function has to "look". If the result is 1, it will consider the first column of the range (in our case the B column). If it's 2, it will consider the second column (in our case the C column).
About (A2-1)*2+1: let's change it a bit so it will be easier to visualize while i explain it:
1+(A2-1)*2
We can divide the formula in 2 parts: the 1 which stand as our starting point (the first column) and the (A2-1)*2+1 which deal with the shift in columns according to the shift in weeks. In cell A2 we find the number of the week. In the first sheet we have 2 columns for each weeks. Therefore when the week shifts by 1, our target column will have to shift by 2. We can't just multiply by 2 the week sheet because it's the shift from the first week that counts for 2, not the actual value. At the first week we will have no shift. Therefore our shift will have to be 0; but we can't just use a 0 because there is no "zero column" in a range. Therefore we need to have our starting value of 1 that is summed to the shift. This way for the first week we will have:
1+(1-1)*2
1+(0)*2
1+0
1
First column of the range $B$2:$E$7 (which is column B). For the second week we will have:
1+(2-1)*2
1+(1)*2
1+2
3
Third column of the range $B$2:$E$7 (which is column D).
Over all the formula IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2) basically checks if the value in C2 is the same as the first column of the given week. If it's the same value it returns 1, otherwise it returns 2 (basically assuming that the value will be equal to the one in second colum of the given week).
Report any question you have or bug you have encountered. If, according to your judgment, this answer (or any other) is the best solution to your problem you have the privilege to accept it (link).
Let me give you a general approach for conditional formatting, based on a formula:
First you try to set up your formula, which you enter in some cell. The result of the formula should be TRUE in case you want the formatting to be applied, and FALSE in all other cases.
Please edit your question again, showing the formula you have tried for configuring this.
Oh, you just want to copy the formatting of that first sheet. But tell me, how is the formatting of that first sheet determined? Is it also the result of a conditional formatting? And about the numbers of the ADJ/Check column, is that just the sum of the values in the first sheet?
Suppose there are 2 sheets Run1 and Run2 in excel. Both have a column say PassCount. How can we compare PassCount on Run1 and Run2 for greater value such that, if PassCount in Run2 is higher than PassCount from Run1 then Run2 entry should be highlighted in green else it should be red
Edit:
Run2
Run1
Run 1 is exactly same sheet with different values.
Now what I need is: If(C3 of sheet Run14 > C3 of sheet Run13) then highlight C3 of Run14 in green else highlight it in red. This will show if the current result is better than the previous result or not.
You can use a conditional formatting rule with a formula.
In the simplest of cases, the formula just needs to compare the cell in column C in the current row with the cell in column C in the other sheet, in the same row, so the formula would be as follows. Select your data from C3 down to the end of the data, then create a new conditional format that uses a formula and enter this formula:
=$C3>Run1!$C3
If the position of the different values can vary, though, this formula will produce false positives and false negatives. It would be much safer to look up the value that you want to compare, based on the identifier in column A. For this, you can use the formula:
=VLOOKUP($A3,'Run1'!$A:$C,3,FALSE)<C3
For both approaches, take great care with the cell addresses. If you apply the format to several rows, there must not be a $ sign in front of the row number, otherwise the formula will always look at the same row and not the current row.
Edit: If you use Google Sheets, you will need to bring the comparison values into the current sheet using simple formulas like =Sheet1!A1, or you can put the comparison formula into the sheet. The formula will return TRUE or FALS. Then you can let the conditional formatting formula refer to THAT cell on the current sheet to set the format.
I'm wondering how to use conditional formatting in order to highlight specific cells in a column that return an error message in another column after applying a function to it.
eg) Column 1 has data 1 ... n
Column 2 has data f(1) ... f(n); f(n) being a function that sometimes returns errors.
I want to color the cells in Column 1 that return the error in column 2. How would you do this? Thanks!
You can use a simple ISERROR().
Let's say that column 1 is A and column 2 is B.
Select cell A1 and then select the whole column. Cell A1 should be slightly less dark than the other cells (it's the active cell in the selected range). Once you have this, go to conditional formatting and under 'New rule' and 'Use a formula to determine which cells to highight', put the formula:
=ISERROR(B1)
Pick a formatting (e.g. Fill and yellow) and click OK. That should highlight the cells for which column B has errors.
I'm quite new in Excel and I am trying to edit a code already in use.
My question is based on two columns: A and B (Worksheet is a symbollist)
Column A= PLC
Column B= Name.
If Column B has any cells that have the same name those rows will turn red using the following existing code(conditional formatting):
=AND($B2<>"";COUNTIF(tblSymbolList_Name;$B2)>1)
So if cell B2=name and cell B3=name than these rows will fill up with red color. Now I want to add a twist to it like this:
A2=plc1 B2=name
A3=plc2 B3=name
If this happens the rows must return to their original value(because the values in column A are different so it doesn't matter that B is the same), but somehow I can't get this done. Can any of you help me?
Regards,
Patrick
Try this formula with the conditional formatting:
=AND($B2<>"";COUNTIFS(tblSymbolList_Name;$B2;A:A;A2)>1)
I don't know all your named ranges, so replace A:A by the corresponding named range if applicable.
COUNTIFS allows you to count based on multiple criteria.