Conditional formatting using list from another sheet - excel

I have a spreadsheet for work with a list of claims from the previous month. Column A on Sheet1 contains the employer's alphanumeric group# (A2-A501).
Sheet2 contains just a list (A1-A46) of group#'s that don't need review, and I'd like to set a conditional rule so that any row on Sheet1 where the value in the A column matches any of the group#'s in Sheet2, then the entire row formats appropriately to what I set (in this case, highlights red).
I researched online, but couldn't find any that would fit my specific scenario that also worked.

Seems:
=MATCH($A2,vRange,0)
as a Conditional Formatting formula rule suited, where vRange is the name of Workbook scope given to the relevant range in Sheet2.

Select the entire selection you want the formatting to apply to.
Open the conditional formatting menu.
Select "Use a formula to determine which cells to format"
Set your format (fill red)
Enter the following formula
=NOT(ISERROR(VLOOKUP($A1,Sheet2!$A:$A,1,0)))
This assumes that on Sheet2, your group#s that don't need review are in column A.

Related

Conditional formatting based on cell in different column but same row

I apologize if this has been posted, but I haven't found a solution that works.
I have an excel sheet with a lot of data.
I want to make the cells in a certain column (column CG) turn purple if the value of a cell in a different column, but equal row is "no". For example, I want the cell in column CG row 140 to turn purple if the cell in column CS row 140 is no. I want this to happen for every cell in the column. I tried to set up a conditional formatting rule such that the rules applies to =$CG$4:$CG$200 and for the formula I've tried $CS=no, $CS="no" $CS4="no" and $CS4=no with the formatting just being a purple highlight. I've tried hitting apply and ok, but nothing works.
I used these link to determine what to do for my rule.
Conditional formatting based on other column
Excel Conditional Formatting based on Other Column
Any suggestions?
Simply highlight the entire column "CG" then open the CF dialog.
Select the option Use a formula to determine which cells to format and type in the following formula:
=$CS1="no"
Then proceed to set your formatting, in your case, a purple fill.

Conditional format cell if row contains one or more blank cells?

Imagine a sheet where column A is names and the other columns contain relevant information for those names. I want to conditionally format the cells in column A so that if there is a blank cell in that row that should be filled, the name cell will display the conditional formatting; think of it like a "there's missing info for this person" indicator.
Before this gets brought up: while it's trivial to set up conditional formatting to color empty cells, coloring the blank cell itself has proven to be not sufficiently noticeable due to the width of the spreadsheet.
It's exactly as #mehdi said. You need to use COUNTBLANK(range).
For conditional format, use the option "Format Cells where this formula is true". My formula in cell A2 is like this:
=IF(COUNTBLANK(2:2)>0;TRUE;FALSE)
After typing it, just change the range where this rule applies and select your range data.
I did it like you can see in the image below (please, note I got spanish version of Excel). In my case, if ANY cell in the row is blank, then it colours with yellow the cell.

How to reference values within a different cell for conditional formatting over multiple columns

I am currently trying to write a rule for conditional formatting that will highlight the relevant cells if they show up within other referenced cells.
For eg. the data has 10 columns but I am only interested in highlighting the two cells in the same row from two of the columns if the values within them are both present within the referenced cells. These referenced cells are not part of the 10 columns and exist on a different sheet.
Essentially my logic is something like "if cellA exists inside reference cellA and cellB exists insde reference cellB then highlight cellA and cellB". Even if the whole row got highlighted that would still be sufficient for now.
Any pointers would be greatly appreciated.
Thanks!
Click the cell that you want to create a Conditional Formatting rule. (in this example I assume it's A1)
Then Create a New Rule
Then choose Use a formula to determine which cells to format
Then copy this formula: (I assume the Reference's worksheet name is Sheet1 and your 10 column range is B:K)
=COUNTIF(Sheet1!B:K,A1)
Also don't forget to choose your conditional formatting type (colour, border shape ant etc.)
I understand you question in 2 different ways.
1) Highlight cells if the same row contains both of the data from the referenced cells:
Assuming your referenced cells are A1 and B1 in Sheet1,
Select all the 10 columns in Sheet2
In home tab, select conditional formatting --> new rule
Select "Use formula to determine which cells to format"
Enter the below formula in the formula box.
=AND(COUNTIF(1:1,Sheet1!$A$1),COUNTIF(1:1,Sheet1!$B$1))
Select a fill color and press OK. This will highlight the row if both the values in referenced cells are present in the row.
2) Highlight cells if the cells contain either of the data in referenced cells.
Use the below formula,
=OR(A1=Sheet1!$A$1,A1=Sheet1!$B$1)
Let me know if you need any info.

Set conditional formatting to compare content to cells in different sheet

Looking for a way to do conditional formatting on two Excel sheets. The spreadsheet is a log of public patrons with lastname, firstname, date, time, staffinitials, CPU number. I need a way to compare the last name of all entries to a second sheet containing names. Then highlight if they match. Any Ideas?
A simple COUNTIF() or MATCH() function should take care of this handily. Let's say that you want to highlight any last names in Sheet1 column A where that are found in Sheet2 column B.
First select Sheet1's column A with A1 as the ActiveCell. Next choose Home ► Conditional Formatting ► New Rule. When the New Formatting Rule dialog opens, choose the Use a formula to determine which cells to format option and supply =COUNTIF(Sheet2!$B:$B, $A1) for the Format values where this formula is true: text box. Click Format and choose a red Fill. Click OK to accept the formatting and then OK again to create the new rule.
The last names in Sheet1's column A that have matches in Sheet2's column B will be highlighted in red.
Alternate CF Rule formula: =ISNUMBER(MATCH($A1, Sheet2!$B:$B, 0))
Conditional Formatting -- Introduction (Contextures.com)

Format cell color based on value in another sheet and cell

I have a workbook with two sheets. I would like to format the cell background color in the first column of sheet 1 based on the values in the second column of sheet 2.
For example, if the value of of sheet2, row 6, column 2 is say, 4, then I would like the background color of sheet 1, row 4, column 1 to be green. If none of the values in sheet 2, column 2 reference a particlar row in sheet 1, I'd like to leave it set to no color. There's no prohibition against the same value appearing multiple times in the second column of sheet 2. Bonus kudos if you can tell me how to unset the color if the last value in sheet 2 pointing to a row in sheet 1 is removed.
I'm sure that for the Excel wizards out there this could be trivial, but I rarely have occasion to use excel and certainly don't have time to become a black belt in it. Can anyone offer me advice, pointers, or a quick formula to do this? If this is going to take some complex VB code to implement, it isn't worth it.
Thank you!
You can also do this with named ranges so you don't have to copy the cells from Sheet1 to Sheet2:
Define a named range, say Sheet1Vals for the column that has the values on which you want to base your condition. You can define a new named range by using the Insert\Name\Define... menu item. Type in your name, then use the cell browser in the Refers to box to select the cells you want in the range. If the range will change over time (add or remove rows) you can use this formula instead of selecting the cells explicitly:
=OFFSET('SheetName'!$COL$ROW,0,0,COUNTA('SheetName'!$COL:$COL)).
Add a -1 before the last ) if the column has a header row.
Define a named range, say Sheet2Vals for the column that has the values you want to conditionally format.
Use the Conditional Formatting dialog to create your conditions. Specify Formula Is in the dropdown, then put this for the formula:
=INDEX(Sheet1Vals, MATCH([FirstCellInRange],Sheet2Vals))=[Condition]
where [FirstCellInRange] is the address of the cell you want to format and [Condition] is the value your checking.
For example, if my conditions in Sheet1 have the values of 1, 2 and 3 and the column I'm formatting is column B in Sheet2 then my conditional formats would be something like:
=INDEX(Sheet1Vals, MATCH(B1,Sheet2Vals))=1
=INDEX(Sheet1Vals, MATCH(B1,Sheet2Vals))=2
=INDEX(Sheet1Vals, MATCH(B1,Sheet2Vals))=3
You can then use the format painter to copy these formats to the rest of the cells.
Here's how I did it in Excel 2003 using conditional formatting.
To apply conditional formatting to Sheet1 using values from Sheet2, you need to mirror the values into Sheet1.
Creating a mirror of Sheet2, column B in Sheet 1
Go to Sheet1.
Insert a new column by right-clicking column A's header and selecting "Insert".
Enter the following formula into A1:
=IF(ISBLANK(Sheet2!B1),"",Sheet2!B1)
Copy A1 by right-clicking it and selecting "Copy".
Paste the formula into column A by right-clicking its header and selecting "Paste".
Sheet1, column A should now exactly mirror the values in Sheet2, column B.
(Note: if you don't like it in column A, it works just as well to have it in column Z or anywhere else.)
Applying the conditional formatting
Stay on Sheet1.
Select column B by left-clicking its header.
Select the menu item Format > Conditional Formatting...
Change Condition 1 to "Formula is" and enter this formula:
=MATCH(B1,$A:$A,0)
Click the Format... button and select a green background.
You should now see the green background applied to the matching cells in Sheet1.
Hiding the mirror column
Stay on Sheet1.
Right-click the header on column A and select "Hide".
This should automatically update Sheet1 whenever anything in Sheet2 is changed.
I'm using Excel 2003 -
The problem with using conditional formatting here is that you can't reference another worksheet or workbook in your conditions. What you can to do is set some column on sheet 1 equal to the appropriate column on sheet 2 (in your example =Sheet2!B6). I used Column F in my example below. Then you can use conditional formatting. Select the cell at Sheet 1, row , column 1 and then go to the conditional formatting menu. Choose "Formula Is" from the drop down and set the condition to "=$F$6=4". Click on the format button and then choose the Patterns tab. Choose the color you want and you're done.
You can use the format painter tool to apply conditional formatting to other cells, but be aware that by default Excel uses absolute references in the conditions. If you want them to be relative you'll need to remove the dollar signs from the condition.
You can have up to 3 conditions applied to a cell (use the add >> button at the bottom of the Conditional formatting dialog) so if the last row is fixed (for example, you know that it will always be row 10) you can use it as a condition to set the background color to none. Assuming that the last value you care about is in row 10 then (still assuming that you've set column F on sheet1 to the corresponding cells on sheet 2) then set the 1st condition to Formula Is =$F$10="" and the pattern to None. Make it the first condition and it will override any following conflicting statements.
Here is my own solution for restoring the original colors when copying certain highly formatted sheets or templates to a new spreadsheet.. it copies all data directly, so it only works if you need to copy a sheet, not only apply colors to a different sheet with different data:
copy the original format workbook by ctrl + g and selecting the appropriate range
paste it into the new work sheet, colors will be all changed
with the destination still highlighted, right click and go to "Paste special" and select "All using source theme", then repeat the paste special, only with "Values" this time, and it should be identical to the original sheet you copied
I've done this before with conditional formatting. It's a great way to visually inspect the cells in a workbook and spot the outliers in your data.

Resources