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 :)
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.
I am trying to setup conditional formatting so that the formatting takes effect if the previous 4 cells in a column are blank. I need the range inside the conditional formatting formula to move as it is applied to cells below it, for example:
If I am tracking sales by store, if there is a 4 week period where a certain store doesn't record any sales I want those 4 weeks to automatically highlight.
My current formula is to select cells B5:B11, enter the formula =SUM(B2:B5)=0 to trigger the cell highlighting.
My problem is that when I look at cell B6 the range it looks for to be blank is still B2:B5 and I need it to be B3:B6.
Is there a way to set this up so that the range will change as it moves down a column?
This one has gotten me thinking a bit, and here is my solution for it.
My solution needs to use four conditional formattings, i.e. set up four conditional formattings in each cell, and then use format painter to apply the conditional format to all the cells.
Suppose your week table is in range A1:D20, and suppose you want to highlight cells if there are at least (not only) four consecutive blank cells.
Highlight cell B2, and then set up conditional formatting using the following four formulas:
=SUM(OFFSET($B2,0,0,4,1))=0
=SUM(OFFSET($B2,-1,0,4,1))=0
=SUM(OFFSET($B2,-2,0,4,1))=0
=SUM(OFFSET($B2,-3,0,4,1))=0
Then should have something similar to the following when examing the conditional formatting window:
Lastly, highlight cell B2, use the Format Painter function under Home tab and then apply the format to the rest of the cells in the week table. Then you should have something similar to the following:
It is easy to find the first blank cell of four consecutive blank cells, but it is difficult to identify the second, third and fourth blank cells using one formula. The workaround uses four different formulas to identify each of the four blank cells (I hope this makes sense). Please note the following is only looking at Column B of my example, not all columns:
Not pretty, but it works. This will highlight all occasions where the store has at least 4 weeks of consecutive donuts.
Columns B:D = Original Data
Columns E:G = Helper Set 1
Columns H:J = Helper Set 2
There's probably a way to get just one helper set, but this works and was easy to validate. First I added 3 empty rows above week 1.
In cells E4, E5 and E6 place a 0. You don't have to, you could also leave these blank.
Cell E5 formula, which is counting the number of consecutive blanks:
=IF(ISBLANK(B5),E4+1,0)
Drag it over to column G and drag it down.
Cell H5 formula, which is looking at 4 weeks later to see if there were consecutive blanks found in helper set 1:
=IF(E8>=4,"Yes","No")
Drag it over to column J and drag it down. Also, in the row above it, repeat week 1 values.
Lastly, select your original data range (B5:D14) and create this conditional formatting formula:
=(OR(H5="Yes",H4="Yes",H3="Yes",H2="Yes"))
Once you're satisfied, you can hide rows 2:4 and can also hide your helper columns.
Apply the following condition to each respective ranges:
Range: B2:D2:
=SUM(B2:B5)=0
Range: B3:D3:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0)
Range: B4:D4:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0, SUM(B4:B7)=0)
Range: B4:D8:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0, SUM(B4:B7)=0, SUM(B5:B8)=0)
Result with sample data:
I have a report where columns BT:DB have 0's and 1's. If there is a 1 in that row for an employee, I'd like to highlight the employee's name in column A. I do not want to highlight the whole row.
How would I enter a conditional formatting formula to say: If a cell in this row has a 1 in columns BT:DB, then highlight those cells with 1's and also the employee name in column A of that row, as well?
You will need to apply your conditional format to Column A.
Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format
Then use the formula: =SUM(BT1:DB1) (No locked cell references on row)
0 = False & >0 = True which will decide if your column is highlighted or not. You can also choose what range to apply the format to.
I used different ranges below so I can fit the example nicely into a screen shot. You will just need to update the ranges to fit your specific needs.
I want to change the colours of cells in a specific column when I enter "Y" in one of 3 other columns.
example: when I enter a "Y" in B3 the cell A3 turns red.
There is more, I want to create a whole table that has three columns each representing a form of communication. When a person requests to be contacted I can put a "Y" in one of the columns depending on the communication type.
When I put a "Y" in one of the three columns the cell in column A of the corresponding row turns red.
example: when a "Y" in one of any of the cells from B3-B33; C3-C33; D3-D33 the cells in for corresponding row from the A column turns red.
example: when a "Y" is placed in B30, A30 turns red; when a "Y" is placed in C7, A7 turns Red; If a "Y" is entered into D16, A16 turns red etc.
Then, I want the cell in the A column to turn yellow when an "X" is placed into the corresponding E column on the same row this is represented by the person have being contacted.
Then, I want the cell in column A to turn green, when the and "X" is place into the F column of the corresponding cell in Column A on the same row. This represents that the person has responded and dealt with.
I have tried work out excel code to make these conditions work but I am struggling. Any suggestions?
You can use conditional formatting in this order:
First apply conditional formatting for Column F (check mark on "Stop if True")
Second apply conditional formatting for Column E (check mark on "Stop if True")
Third Apply conditional formatting for Column B,C & D
To add conditional formatting, follow these step:
Go to Home tab > Conditional formatting > New Rule
Select: Use a formula to determine which cells to format
Input the formula shown in image
Format the fill color per your requirement
Click on Apply
To apply to the column A, you need to change applies to range using:
Conditional Formatting > Manage Rules > Select the rule and change
range address depending on your data size.
Please see this image:
The third condition is as under:
Have you tried to use conditional formatting? you can start off by doing a simple case.
In order to have multiple cases apply to the same cell you can access the conditional formatting rules manager from the conditional formatting menu.
From there you can add additional rules for a cell.
For the formula itself i'd advise choosing: use a formula to determine which cells to format.
When the formula returns "true" the formatting will be used, so then you can make it search for all the row range you mentioned for the character you decide, you will need 1 rule for each color/character.
once you have done the formatting for one row you can drag it to apply it to all the rows if i remember correctly.
I'm fairly new to Excel and so not very experienced, but I'm trying to get an entire row to highlight red based on 2 other cells, using conditional formatting. The requirements are for the corresponding M cell in the row to have the value 'N' and for the corresponding E cell to have a past date value '<*NOW'.
I've tried a formula based on an answer for multiple conditions:
=AND(M="(N)";E<*NOW)
A formula for formatting an entire row:
=INDIRECT("m"&ROW())="N",("e"&ROW())E<*NOW
And combining the two:
=AND=INDIRECT("m"&ROW())="N",=INDIRECT("e"&ROW())E<*NOW)
(ignore all the asterisks its the only way i could get the NOW to appear)
None of these are working, please help!
Assuming your data starts at row 2 then select all rows, e.g. 2 to 100 and then apply the condition for row 2, i.e. use this formula
=AND($M2="N",$E2<TODAY())
That will now apply to the whole range. The $ signs make it format the whole row