Change cell colour according to value in adjacent column - excel

I'm sure this is very easy, but I can't make conditional formatting work for me. What I am trying to do (example attached), is have one column for date, one column for an action to be taken and one column to assert whether the action is done or not (y /N). This worksheet will be expanding every day so needs to be future-proofed.
I am trying to get the cells in column b to either display Red when an 'n' is displayed in the adjacent cell in Column C, or change to Green when a 'y' is entered in column c.
I can get one cell to do it, but when I apply the formatting to the whole column, it changes ALL the cells in column 'B' to green when I type a 'Y' see example
. I suppose what I need is an 'if' statement, or a way of dragging a formula down the column B - but I can't work it out.
Any help gratefully appreciated!

Try this, select the cell where you want the background color and click "Conditional formatting" then add a "New rule" and select "Use a formula to determine which cells to format" option.
In the formula field write =EXACT(CELL;"y"), where CELL is the cell you have your y/n value. In the format, set the background green or the color you want.
This way you can add another rule to check if content is n an set bg red.
With autocomplete of excel just drag down and every cell should updates their conditions to check their adjacent cells.
It should look like:

Related

How to make cell format change depending on checkbox value in Excel

Here is what I am trying to achieve in Excel. My objective is to have a list of taks on the left and a list of tests in all the others columns.
What I would like to achieve is that when I check a checkbox for a task (for example task "a", all other cells containing the letter "a" get colored in green), like shown below:
Similarly, when I click on task b, all cells containing "b" get colored in green.
Then, if all steps of a test are in green, the text turns green and increase the number of tests that can be tested, like shown below.
The thing that I have tried yet is to do some conditionnal formatting but I cant find a generic formula that says (if my cell has the value of a cell that is checked). Help would greatly be appreciated!
Follow these steps
Right Click on checkbox of each cell, Start from B3 Checkbox. Click on Format Control at the end of option window. In the Cell Link Type the Same Cell Name of Checkbox, e.g B3
(for Each checkbox, you have to put its Cell link manually)
Select Whole Column B and then select the font color White. So the text TRUE or FALSE of selected or unselected checkbox will not overviewed.
Copy this formula in D2
=IFERROR(IF(INDEX(B:B,MATCH(E2,A:A,0))=TRUE,E2,""),"")
Drag it down
Select Column E, Go to conditional Formatting > New Rule > Use a formula to determine which cells to format
Use this formula in there
=AND(D2=E2,E2<>"")
Then Select Column G and select its font color White
in G2 Use this Formula
=IF(F2="","",IF(COUNTIF($F$2:$F$20,F2)=COUNTIF($D$2:$D$20,F2),F2,""))
Select Column F, Go to conditional Formatting > New Rule > Use a formula to determine which cells to format
Use this formula in there
=AND(G2=F2,F2<>"")
Select Column A, Go to same conditional formatting as above and use
=B3=TRUE
You are done

How do I change the color of a column based on the color of other column?

I am having trouble coloring cells in a column (if a cell D2 is light green, then B2 is colored light green).
I have tried using conditional formatting, and looked at Changing Color of a column based on other column in put
However, I do not know what to put in formula to say that a cell D2 is light green.
Let me know if I broke any rules here, and I'll fix.
Like I said many times before: Color is not data. There is no worksheet formula or conditional formatting rule that can evaluate the color of a cell.
The reason or logic for that manually applied color is in a person's head, but not derivable from data in the spreadsheet.
Use real data in the spreadsheet if you want to use conditional formatting or worksheet formulas.
If you want to evaluate cells by their color and apply that same color to another cell, you will need to use VBA.
Apart from using vba, if you can tolerate the following:
manually refresh the conditional formatting for Column B each time you change the colour in Column D
save and continue to use your workbook as .xlsm (macro enabled workbook)
then try the following:
Please note I used the following sample data (starting from the first row) where Column A serves as Column D in your question:
In the Name Manager, set up a name called GetCellColour with the following formula:
=GET.CELL(63,$A1)
Replace $A1 with $D2 or the actual cell reference in your real case. This should be cell that will trigger the conditional formatting in B2.
Set a light green colour in cell A1, and in a blank cell say C1 enter the following formula:
=GetCellColour
In my example the colour code returned by the above formula is 35 for light green.
Highlight Column B (or the relevant range in Column B that you want to apply the conditional formatting rule) with cell B1 being the active cell, go to Conditional Formatting function to set up the following formatting rule:
=GetCellColour=35
Then your cells in Column B will be highlighted by light green colour if the corresponding cell in Column A is colored in light green. Please note, if you changed the cell colour in Column A, you need to go to Data tab to Refresh the worksheet to "update" the conditional format in Column B.
Here is a live demo:
For the use of GET.CELL function in the name manager, you can give a read to this article.
Let me know if you have any questions. Cheers :)

Excel Conditional formatting whole table color code

I would like to create a condition for my whole table.
I have three categories (i.e R, G, B).
If the first column (example: A1) is R, the rest of the ROW (ex: B1:E1) should be colored with red. If G, then green, and if B, then Blue.
What I've done so far is I've selected my work area which is B1:E1, then clicked on conditional formatting > new rule > "Use a formula to determine which cell to format" (I'm using excel 2010). Then Typed this at the formula bar =SEARCH("R", $A$1)>0. It does change the color of B1:E1, however, I don't know how to do this for my whole table. If I select my whole table, and A1 is equal to R or G or B, the whole table change its color to whatever the value of A1. I also change my formula to =SEARCH("R", $A$1:$A$120)>0 which is the range of my table, still doesn't work. I've also created 3 conditions for each color with same formula (I just changed the letter R to G and B), still does not work.
Any ideas? Thank you in advance.
you were actually pretty close, just change
=SEARCH("R", $A$1)>0
to
=SEARCH("R", $A1)>0
so the conditional formatting rule will always look for "R" in the current row rather than row 1.
You should have this rule apply to the whole range that may be colored (I'm guessing B1:E120)
Also, you can make two rules for your other colors using the same approach.

Excel Lookup between multiple columns

I need your assistance with Excel. I have the following columns on my worksheet
EmployeeNumber, EmployeeName, SalesID,Email, EmployeeNumberID.
The EmployeeNumber and EmployeeNumberID columns are the key columns as these contain the employee number. The problem is that EmployeeNumber contains all employees from different departments and EmployeeNumberID contains employee from the Sales department.
Could you please assist with highlighting the EmployeeNumber that are not in the EmployeeNumberID column, if we could highlight the entire row that would be great.
Mnay Thanks
Assuming your data is layed out as per the image below, select the range from A2 to E9 and ensure that the upper left cell A2 is your active cell. Notice in the image the active cell has a light background compared to the grey background of the rest of the selected range.
Then go to your HOME ribbon and select conditional formatting.
From the drop down menu that appears select New Rule.
In the New Formatting Rule window that appears select "Use a formula to determine which cells to format" at the bottom of the list. Then click to format button and chose whatever formatting you want to have applied. I would recommend the Fill tab and then select a colour.
Enter the following logical check in the "Format values where this formula is true:" box:
=COUNTIF($E$2:$E$9,$A2)=0
It will count the number of times Employee number in column A occurs in Column E. It will then check to see if that count is zero meaning its not in column or not part of the sales team, and apply the formatting you selected early to all cells in the row from A to E. If you only want to colour cells in column A then select A2:A9 as your initial selection area for applying conditional formatting to. The equation should not need to change.
Proof of Concept
You just need some conditional formatting. Select the area you want to apply the highlighting to, lets say A:E, then use conditional formatting with the following formula:
=ISNA(MATCH($A1,$E:$E,0))
assuming EmployeeNumber is in column A and EmployeeNumberID is in column E.
What this does is tries to match the EmployeeNumber to a value in column E. If it fails, then it will return #N/A and ISNA will return TRUE and the row will be highlighted.
Note that $A1 should be the top left cell in the range you are formatting. If you start lower, adjust the cell accordingly.

Conditional formatting based on reference cell value for each cell in row

I would like to color cells in each row based on the value of a cell in the same row and then do the next one.
How do you set the formula to be able to color the cell if not equal to a reference cell on the same row?
So I just want to change the color of a different cell than reference cell which will have a different value for each row.
In Excel you will need to create a formatting rule, within the modal select the option that you want to use a formula to decide what cells to format:
Within the edit box you can type the formula that is used. The formula in the example will check whether the value of the 1 cell in the column is not empty. If this is true, the cell will be formatted as specified in the format preview.
Mainly using the ROW and COLUMN functions in Excel you can get access to the current Row and Column of the Cell for which the formula is executed.
Given the input:
Select Cells B2:G6 and click on Conditional Formatting
Your prompt will look different on Windows, but the important part is "Use a formula to determine which cells to format" The formula is =B2<>$A2 Please note the lack of $ because it needs to be flexible (except for the reference cell column which in my case is A)
Final result is:
Conditional formatting foes not need to operate on the cell you are formatting. Using a mixture of $ and non-$ formatted formulas, you can set highlighting accordingly.
Note to make sure this works correctly, highlight the area to be formatted first, and note where you start. e.g. If I wanted this to apply to A2:A50, then I would highlight A2 first, and make the formula reference row 2.
Also, note that you will have to type in the formula. Any clicking of cells will automatically put in $ signs to fix the comparison to that specific location, which is not the behavior we desire
e.g. To format A2:K50, when the H value in that column is 7
Highlight A2:K50
Conditional Formatting -> New Rule -> Use a formula
formula would be =($H2=7) <- this will fix the column to be H, and vary the row accordingly
Format as desired
e.g.2. To format based on previous cell
Highlight A2:A50
Conditional Formatting -> New Rule -> Use a formula
formula would be =(A2<>A1) <- this will check the row above each time
Format as desired

Resources