How do I automatically have excel color code the cells in my table, to the legend I have in column I based on the text values? Is there a formula I can use to do this as I do know VB. I don't mind entering a new rule for each color as long as it pulls the correct text in column I and matches it to the table.
Table = Cells B2:F13 containing all text values
Column I2:I5 = text "YELLOW,PINK,PURPLE,BLUE" Fill color to be Yellow
Column I7:I10 = text "GREY,TAN,TEAL,MUSTARD" Fill color to be Green
Column I12:I14 = text "GREEN,ORANGE,RED" Fill color to be Orange
First select cell B2. In the Conditional Formatting Rules you will need to make 3 rules, one for each fill color. Select the 'Use a formula to determine which cells to format' option. Now we will use Excel's formulas to determine if the text matches the legend. Enter the following formula into the conditional format for B2:
=IFERROR(MATCH(B2,$I$2:$I$5,0),0)>0
That is the code for matching to the Yellow, Pink, Purple, and Blue keywords. This takes the value in the cell it applies to and looks for it in the legend referenced, if the match function finds the text it returns the location in the array, a non-zero number. If match doesn't find a match it throws an error, which we catch with the iferror function which converts it into a 0. Finally, we compare our result to 0 which gives us the true/false that the conditional format needs.
Note that the first reference B2 is relative while the match array reference is absolute. This way when we expand the conditional format to cover the whole area it updates the reference to apply to each cell, but not the reference to our legend.
For the other 2 colors simply adjust the match array to the other references.
Then the final step is to go into the conditional formatting rules manager and adjust the 'applies to' range to the full range instead of just B2.
Related
I have 7 Columns, 5 with data and the first two with names. Is there a formula I can use in conditional formatting where if I change my column from the drop-down, conditional formatting will look in that column and highlight the name with less than 25, and when i change the value of Capture, the purple highlight across the columns changes too?
.
Hope it makes sense
Suppose you have the following named ranges:
Capture being the column number that you want to change dynamically;
ListFOR being the list of names you have in the FOR column;
RngData being the values in your table excluding the first column and column headers.
I will use the following example to demonstrate my answer:
To highlight a specific column by changing Capture value:
Highlight range B3:G10 (which is the 6 columns including headers on the right) with cell B3 being the active cell;
Use the following formula as the Formatting Rule in conditional formatting and set the background color as desired:
=COLUMN(A$1)=Capture
The logic is to compare the value returned by COLUMN function with the Capture value, if they are the same i.e. TRUE, apply the conditional format.
To highlight a specific name or names with value less than 25 in the highlighted column from previous step:
Highlight range A4:A10 (which is the first column without header) with cell A4 being the active cell;
Use the following formula as the Formatting Rule in conditional formatting and set the background color as desired:
=INDEX(RngData<25,MATCH($A4,ListFOR,0),Capture)
The logic is to first convert the values into TRUE or FALSE by comparing them with 25, then use INDEX+MATCH function to return the logical result based on the given name, if TRUE apply the conditional format.
Here is a live demo:
Let me know if you have any questions. Cheers :)
So the problem I have is trying to change the fill color using conditional formatting in excel. This is basically what I want to do:
First I have a column, something like this:
1
1
1
2
2
3
4
4
4
Now I want to use conditional formatting to check if cell A2=A1, if it is to have fill color #1, and so on. Once it gets to cell A4 and it checks that A4=A3, if it does not match I want it to switch the fill to fill color #2, and it continues to check. Basically every time the cell does not match the value of the cell above, to switch to a different fill color.
I tried using the OFFSET function to check if that value was the same as the cell above, that worked but once I added the function to conditional formatting it went all funky and did not change colors.
Using your sample data, say you put them into cell A1 to A9, highlight cell A2:A9 only, and set up the conditional formatting as shown below.
For duplicated value you will use =A2=A1
For different value you will use =A2<>A1
select a cell outside of your table (let's say it's Z1) and fill it with the value: AB
cell B1 value: A
in all cells from B2 downwards: =IF(A2=A1,B1,SUBSTITUTE($Z$1,B1,""))
it means that if A2<>A1, B2="B"; if A3=A2, B3=B2="B"
fill all cells on column A with the color you want for "cluster" B: let's say it's blue
add "$B1="A" in conditional formatting, filling = red
is it possible to use a formula in conditional formatting to change the fill color of one cell based on the fill color of another cell. All I can find is value based formatting. I have a large sheet that has many rows in one color with nothing in the cell and I want to change those cells to another color without having to select them.
You could use the Excel 4.0 Macro Function GET.CELL:
Returns information about the formatting, location, or contents of a
cell. Use GET.CELL in a macro whose behavior is determined by the
status of a particular cell.
Syntax
GET.CELL(type_num, reference)
type_num = 39:
Shade background color as a number in the range 1 to 56. If color is automatic, returns 0.
With cell B1 selected create a named range called FillColour.
This refers to: =GET.CELL(38,A1)
Now, if you enter the formula =FillColour in cell B1 it will show a different value when you change the background colour of cell A1.
NB: You may have to manually force a recalculation for it to work.
Next add conditional formatting rules: =FillColour=29 will be TRUE if the cell to the left of the CF is formatted as purple (RGB: 177, 160, 199).
I have two columns: In the first there might or might not be a value;
in the second column, if the first cell next to it is empty, I want to colour the cell in a grey colour.
Is there an easy way to change a cells background colour, if a different cell is empty?
Please select your second column and with Format, Conditional formatting..., Format cells if..., Custom formula is enter:
=isblank(A1)
and for Formatting style choose grey fill, Done.
Change "A" in the formula to the reference letter for your first column.
How do i change the colored cell values.
Using conditional formatting I have changed the cell value into red using a condition
cell value is = less than or equal to(zero)
After that I want to change those red colored cell values filled with '-'.
Create a "Custom" format for the target cells:
In the Type window you have 3 areas divided by semi-colons:
£#,##0.00;-;-
The first section will be applied to positive numbers - the second to negative and the third to zero. Just type in the formats you want.
Works like this: