## 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 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 […]

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 […]

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 […]

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 […]

This blog post shows you how to easily identify duplicate rows or records in a list. Conditional formatting formula: =COUNTIFS($B$3:$B$15, […]

### One Response 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 […]