Highlight cell if value is present in any cell in another column - google-sheets

I want to highlight the cell in column A if it is repeated anywhere in column B. For example:
A | B
pack_1 | unrelated
pack_2 | unrelated
pack_3 | pack_1
pack_4 | pack_1
pack_5 | pack_3
pack_6 | pack_3
pack_7 | unrelated
pack_8 | pack_2
In the example, pack_1, pack_2 and pack_3 should be highlighted because they are mentioned in column B.
How can I do such a thing?

Please select ColumnA, Format, Conditional formatting..., Custom formula is:
=match(A1,B:B,0)>0
with formatting of choice.

Do conditional formatting on each cell with the formula:
=EQ(VLOOKUP(A1, B:B, 1, FALSE), A1)
And format the cell to a different color if it matches.
I shared an example here (this link will ask you to make a copy in your own Google Drive account):
https://docs.google.com/spreadsheets/d/1IovLko1cF2guKnIalCyE0uSbCvMDYLgL0BZHt35znXI/copy

You would add conditional formatting to A1 and then copy to rest of the cells in the column.
Set the conditional formatting to custom formula and make the formula:
=COUNTIF($B$1:$B$8,A1)
And set your color.
It will highlight the cells in the A column if they exist in the B column.
(Keep in mind I Am assuming your range is B1:B8)

Select both columns
click Conditional Formatting
click Highlight Cells Rules
click Duplicate Values (the defaults should be OK)
Duplicates are now highlighted in red:

Related

Conditional Formatting from cells in adjacent column

[inventory sheet] (https://docs.google.com/spreadsheets/d/1kLDo8Up_RJa2rXsEZ9ElKBEhGUTsMw61-fQspOPuBz4/edit#gid=0)
I'm trying to conditionally format column E based on column D. For example, if the value in column D is <8, highlight the adjacent cell in column E green. If value is >7 and <15, highlight yellow. If value is >14, highlight red.
The formula I have now works, but I can't figure how to apply the formatting to the entire column without manually inputting 3+ conditional format rules on each individual cell.
The existing conditional format from your sheet is partially correct, it just needs some tweaking on the Apply to range value. You can create 3 conditional formats on E3 and it will apply to the whole column of E if you put the E3:E on range.
Please see the 3 conditional formats I have created based from your given sheet.
Conditional format 1:
Conditional format 2:
Conditional format 3:
Output:
Reference:
AND function
Just select the whole range and create one single rule per condition. Use the formula as it is created for the first cell and it will "drag" automatically.
For example with =D2>15

How Do I Highlight a Cell a Certain Color if the values in two other cells match?

I'm trying to get a cell to highlight with a certain color if the text of two other cells match. Has anyone else done this?
Example:
If the value in the cell A2 is "Car" and the value "Car" is in a range on another sheet, can the cell B2 be filled with a color?
Assuming a range on another sheet is ColumnC of Sheet2, then select B2, apply the Conditional Formatting custom formula:
=match(A2,indirect("Sheet2!C:C"),0)
and certain colour fill.
This can be achieved using conditional formatting.
Select the cell (B2 in your example) and in the menu bar go to Format > Conditional Formatting...
Here you want to use a custom formula. Specifically for your example, the formula to input would be:
=AND(A2="Car",COUNTIF(C2:C5,"Car")>0)
Note that the range that is being checked for "Car" is C2:C5, since you didn't specify any for your example.
EDIT:
Following the discussion in the comments:
=COUNTIF(Sheet2!$C:$C,A2)>0
What this does, is that it looks for the value in A2 in column C in Sheet2 and if it occurs once or more, the cell that you have applied this conditional formatting to, will be coloured.

Conditional Formatting cells based on how many times it appears in separate Column

https://docs.google.com/spreadsheets/d/12TsEEj3LQSIOv2m6LRRS6FCLvIkuUo_ECfQvK4gw4d8/edit?usp=sharing
I want to use conditional formatting to count the amount of times a name appears in Column H and make the corresponding name in Column B red if it shows up once and crossed out if it shows up twice.
How can I do this? I used COUNTIF but I don't know how to attach the formatting to a specific name/string in Column B so it just formats the next one on the list (I think).
Any advice or help would be greatly appreciated.
Clear any conditional formatting from ColumnB, select B3 to the end of your range to format and Format, Conditional formatting..., Format cells if... Custom formula is and
=countif(H:H,B3)=2
with strikethrough. Add another rule (same range) with Custom formula is and
=countif(H:H,B3)=1
with red fill and Done.

google spreadsheet conditional formatting on a column

I have a set of data range from A to G for instance, at column G, I would like to format the cell as following
if the value of G2 is between C2 and D2, then the background color is green.
if the value of G3 is between C3 and D3, then the background color is green.
and so on for the next 500 rows
How may I do it in the latest google spreadsheet please?
Many thanks
In G2 select Conditional Formatting select custom formula and enter
=and(G2>C2,G2<D2).
Then select Apply to range and enter G2:G. It will work for all column G .
Since format the cell I assume only to apply to ColumnG. Please try selecting ColumnG and Format, Conditional formatting..., change G1: in start of Apply to range to G2: and for Format cells if... select Custom formula is and insert there:
=or(and(G2<C2;G2>D2);and(G2>C2;G2<D2))
select green fill and Done.
Change ; to , if required for your locale setting.
With text labels in Row1 it is usually simpler to select the entire column and write such a formula for Row1.

Conditional Formatting from another sheet

I'm trying to have a cell on Sheet A check if it's either > or < the value in a cell on Sheet B, then change its color accordingly. Under the custom formula I use: =A1>("SheetB!A1"), but it doesn't seem to work. I use the color Green for the > and the color Red for the <. Every time the rules are saved it will always display A1 on Sheet A in red.
Is the function wrong? Or is it not possible to have a Conditional Format even search across sheets?
For some reason (I confess I don't really know why) a custom formula in conditional formatting does not directly support cross-sheet references.
But cross-sheet references are supported INDIRECT-ly:
=A1>INDIRECT("SheetB!A1")
or if you want to compare A1:B10 on SheetA with A1:B10 on SheetB, then use:
=A1>INDIRECT("SheetB!A1:B10")
=A1>INDIRECT("SheetB!"&CELL("address",A1))
applied to range A1:B10.
You can do this by referencing the cell and row number in the current sheet, so as you drag-copy that conditional formatting to other rows it will reference the correct cells.
In the below equation I am coloring cells based on the exact same cell in some other sheet named "otherSheetName" in this example. If for example you want to color cell B2 in Sheet2 if the cell B2 in otherSheetName contains the text "I Like Dogs" you would go to cell Sheet2!B2 , click condition formatting, choose equation from the drop down and paste the below equation.
=IF(INDIRECT("otherSheetName!"&ADDRESS(ROW();COLUMN()))="I Like Dogs";1;0)
Comparing strings instead of numbers for a conditional formatting rule, you can use:
=EXACT(A1,(INDIRECT("Sheet2!A1")))
Case sensitive.
There is one trick/bug: if you have conditional formatting in Sheet1 that explicitly references itself (e.g., the formula is Sheet1!$C$2), you can copy the conditional formatting to Sheet2 with Paste special > conditional formatting and it will "work"... as long as you don't touch anything:
if you try to edit the conditional formatting in Sheet2, then you'll get an "Invalid formula" error.
if columns/rows change in Sheet1 such that they affect the conditional formatting (e.g., row/column inserts), this is not reflected in Sheet2 (keep in mind that the indirect trick mentioned by #AdamL will also not reflect column/row updates either, so it's a wash in this respect).
I was able to compare two sheet and highlight the differences on the second sheet using conditional formatting :
=A1<>(INDIRECT("Sheet1!"&Address(Row(),Column(),)))

Resources