Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditionally formatting cells if their value equals any value of another column

I have data in the A and B columns. B column's data is mostly duplicates of A's data, but not always. For example:

A
Budapest
Prague
Paris
Bukarest
Moscow
Rome
New York

B
Budapest
Prague
Los Angeles
Bukarest

I need to search the A column for the values in B. If a row matches, I need to change the row's background colour in A to red or something.

like image 391
PeterInvincible Avatar asked Dec 07 '14 17:12

PeterInvincible


People also ask

How do you highlight cell if same value exists in another column in Excel?

You can check if the values in column A exist in column B using VLOOKUP. Select cell C2 by clicking on it. Insert the formula in “=IF(ISERROR(VLOOKUP(A2,$B$2:$B$1001,1,FALSE)),FALSE,TRUE)” the formula bar. Press Enter to assign the formula to C2.


1 Answers

Here is the formula

create a new rule in conditional formating based on a formula. Use the following formula and apply it to $A:$A

=NOT(ISERROR(MATCH(A1,$B$1:$B$1000,0)))


enter image description here

here is the example sheet to download if you encounter problems


UPDATE
here is @pnuts's suggestion which works perfect as well:

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


like image 200
Marcel Avatar answered Oct 08 '22 18:10

Marcel