Highlight cell if value is present in any cell in another column
Asked Answered
A

4

18

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?

Aplanatic answered 14/3, 2015 at 17:16 Comment(1)
furman87, your solution is exactly what I need. I would select it as answer if I could.Aplanatic
D
19

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

Dessert answered 14/3, 2015 at 17:36 Comment(0)
L
17

Please select ColumnA, Format, Conditional formatting..., Custom formula is:

=match(A1,B:B,0)>0 

with formatting of choice.

Lustreware answered 16/3, 2015 at 15:34 Comment(1)
This works. Additionally I need to set 'Apply to range' to 'A1:A1090', which is applies the rule to that range for my case. Note that the other answer works too but this formula looks simpler =)Sororicide
B
2

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)

Better answered 12/10, 2021 at 2:6 Comment(0)
F
-1
  1. Select both columns
  2. click Conditional Formatting
  3. click Highlight Cells Rules
  4. click Duplicate Values (the defaults should be OK)
  5. Duplicates are now highlighted in red:

Example. Duplicates are highlighted in red

Flock answered 12/7, 2017 at 7:13 Comment(1)
we're in google sheets, not excelWexler

© 2022 - 2024 — McMap. All rights reserved.