## Compare two columns and highlight values in common

A conditional formatting formula highlights values in column B that also exist in column D.

The same thing happens in column D, a conditional formatting formula highlights values in common between column B and D.

### How to highlight common values

- Select cell range B3:B7
- Go to tab "Home" on the ribbon if you are not there already
- Click on Conditional Formatting button
- Click on "New Rule..."

- Click on "Use a formula to determine which cells to format"
- Type: = COUNTIF($D$3:$D$7, B3)

- Click on "Format..." button
- Click on "Fill" tab.
- Pick a color
- Click OK
- Click OK

Repeat above steps with column D, the formula is at the top of this article.

### Explaining conditional formatting formula

The COUNTIF function counts how many times value in cell B3 is found in cell range $D$3:$D$7. B3 changes to B4 when Excel moves on to next cell below, however, that is not the case with $D$3:$D$7.

The $ dollar signs make this cell reference locked, in other words, it doesn't change.

The Conditional Formatting in Excel interprets all numbers except 0 as TRUE so if the COUNTIF function finds a value twice and returns 2 doesn't matter, it still highlights the cell.

### Download excel *.xlsx file

Compare two columns and highlight matches.xlsx

*This blog article is one out of five articles on the same subject.*

**Filter values existing in range 1 but not in range 2 using array formula in excel****Filter common values between two ranges using array formula in excel****How to remove common values between two columns****How to find common values from two lists****Highlight common values in two lists using conditional formatting in excel**

Compare tables: Highlight records not in both tables

The image above demonstrates a conditional formatting formula that highlights records that only exist in one table. There are two […]

Compare two lists of data: Highlight common records

In this blog post I will demonstrate a conditional formatting formula that will highlight common records in two lists. The […]

Highlight missing values between to columns

The picture above shows two lists. How do I highlight values in List 1 that are not in List 2? […]

Highlight overlapping date ranges using conditional formatting

The image above demonstrates a conditional formatting formula that colors a record if there is at least one record that […]

Count Conditionally Formatted cells

This article explains how to count cells highlighted with Conditional Formatting (CF). The image above shows data in cell range […]

Highlight records based on overlapping date ranges and a condition

adam asks: Hi, I have a situation where I want to count if this value is duplicate and if it […]

Highlight dates in a date range

Question: How do I highlight dates that meet criteria using conditional formatting? Table of contents Highlight values in a column […]

This post demonstrates how to highlight records with the closest value to a criterion, you can also choose to highlight […]

### 3 Responses to “Compare two columns and highlight values in common”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

[…] Highlight common values in two lists using conditional formatting […]

Hai

What a surprise..!

I have visited so many websites, youtube channels for my problem.

I have a excel data that is 2 columns,

column 1 is 2,72,132 records

column 2 is 519 records

I have to highlight or select the records that 519 records which are column no.1

But No body have given correct suggesion.

All are given =Match() or =vlookup() formulas.

but not succeded.

At last your help has given correct result

Thank you for great help which is simple but valuable formula i.e., = COUNTIF($D$3:$D$7, B3).

Thanks once again

.. RAVINDER.

Hi

I have the data in two columns and I want to highlight column B value with using column A value if the value is higher than columns A highlight in column B by using condition formatting.

A B

20.00 3.68

100.00 138.84

85.00 102.70

51.00 2.04

8.00 3.27

10.00 14.00

15.00 10.62

kindly suggest the same.